Authen...MySQL41(3pm)
π Authen...MySQL41 π
okay bestie, so this is a page from the User Contributed Perl Documentation β you know, the lil manual you get for Authen::Passphrase::MySQL41 (it's a 3pm page, obviously π
). Sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
Authen::Passphrase::MySQL41 β passphrases using the MySQL v4.1 algorithm. yes, that MySQL. the old-ish one. iconic behavior tbh.
πΈ SYNOPSIS πΈ
use Authen::Passphrase::MySQL41;
$ppr = Authen::Passphrase::MySQL41->new(
hash_hex => "9CD12C48C4C5DD62914B".
"3FABB93131746E9E9115");
$ppr = Authen::Passphrase::MySQL41->new(
passphrase => "passphrase");
$hash = $ppr->hash;
$hash_hex = $ppr->hash_hex;
if($ppr->match($passphrase)) { ...
look at that. two ways in, three ways out. we love a flexible object π«Ά
π¦ DESCRIPTION π¦
so an object of this class is like a lil container that encapsulates a passphrase hashed using the algorithm MySQL has been using since version 4.1. she's a subclass of Authen::Passphrase, and ngl this doc just assumes you already know the Authen::Passphrase documentation. so go read that first, bestie, fr fr.
the MySQL v4.1 hash scheme? it's based on the SHA-1 digest algorithm. here's the tea: the passphrase gets hashed with SHA-1 first, and then the output of that stage gets hashed with SHA-1 again. the final hash is the output of the second SHA-1. and no salt. none. zero. nada. π
in MySQL, the hash is represented as a "*" followed by 40 uppercase hexadecimal digits.
β οΈ okay so the lack of salt is a genuine weakness in this scheme. like, lowkey a security problem. salted SHA-1 is a better scheme β go look at Authen::Passphrase::SaltedDigest. protect yourself bestie π
π CONSTRUCTOR π
Authen::Passphrase::MySQL41->new(ATTR => VALUE, ...)β generates a brand new passphrase recogniser object using the MySQL v4.1 algorithm. slay. you can pass these attributes:hashβ the hash, as a string of 20 bytes.hash_hexβ the hash, as a string of 40 hexadecimal digits.passphraseβ a passphrase that will be accepted.
either thehashor thepassphrasemust be given. not optional, she needs something to work with π
π METHODS π
$ppr->hashβ returns the hash value, as a string of 20 bytes.$ppr->hash_hexβ returns the hash value, as a string of 40 uppercase hexadecimal digits. uppercase!! the glow-up is in the caps β$ppr->match(PASSPHRASE)β checks if that passphrase matches. heads up: this method is part of the standardAuthen::Passphraseinterface, so it's not a special MySQL-only thing β it's the β¨canonicalβ¨ way in. iykyk.
π SEE ALSO π
Authen::PassphraseDigest::SHA
go read those too, they're the supporting cast and they ate π₯
π AUTHOR π
Andrew Main (Zefram) <zefram@fysh.org> β absolute legend, we stan.
π COPYRIGHT π
Copyright (C) 2006, 2007, 2009, 2010, 2012 Andrew Main (Zefram) <zefram@fysh.org>
π LICENSE π
this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. go wild, that's the whole vibe π§
and that's the page!! a little perl v5.40.1 moment, dated 2026-05-06, and it's one of those Authen...MySQL41(3pm) situations β anyway bestie, hydrate, salt your hashes, and go forth and match π«Άβ¨
π¦ where this page comes from
- ubuntu stonking: libauthen-passphrase-perl 0.009-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms