1Authen::Passphrase::MySUQsLe4r1(C3o)ntributed Perl DocumAeuntthaetni:o:nPassphrase::MySQL41(3)
2
3
4
6 Authen::Passphrase::MySQL41 - passphrases using the MySQL v4.1
7 algorithm
8
10 use Authen::Passphrase::MySQL41;
11
12 $ppr = Authen::Passphrase::MySQL41->new(
13 hash_hex => "9CD12C48C4C5DD62914B".
14 "3FABB93131746E9E9115");
15
16 $ppr = Authen::Passphrase::MySQL41->new(
17 passphrase => "passphrase");
18
19 $hash = $ppr->hash;
20 $hash_hex = $ppr->hash_hex;
21
22 if($ppr->match($passphrase)) { ...
23
25 An object of this class encapsulates a passphrase hashed using the
26 algorithm used by MySQL from version 4.1. This is a subclass of
27 Authen::Passphrase, and this document assumes that the reader is
28 familiar with the documentation for that class.
29
30 The MySQL v4.1 hash scheme is based on the SHA-1 digest algorithm. The
31 passphrase is first hashed using SHA-1, then the output of that stage
32 is hashed using SHA-1 again. The final hash is the output of the
33 second SHA-1. No salt is used.
34
35 In MySQL the hash is represented as a "*" followed by 40 uppercase
36 hexadecimal digits.
37
38 The lack of salt is a weakness in this scheme. Salted SHA-1 is a
39 better scheme; see Authen::Passphrase::SaltedDigest.
40
42 Authen::Passphrase::MySQL41->new(ATTR => VALUE, ...)
43 Generates a new passphrase recogniser object using the MySQL v4.1
44 algorithm. The following attributes may be given:
45
46 hash
47 The hash, as a string of 20 bytes.
48
49 hash_hex
50 The hash, as a string of 40 hexadecimal digits.
51
52 passphrase
53 A passphrase that will be accepted.
54
55 Either the hash or the passphrase must be given.
56
58 $ppr->hash
59 Returns the hash value, as a string of 20 bytes.
60
61 $ppr->hash_hex
62 Returns the hash value, as a string of 40 uppercase hexadecimal
63 digits.
64
65 $ppr->match(PASSPHRASE)
66 This method is part of the standard Authen::Passphrase interface.
67
69 Authen::Passphrase, Digest::SHA
70
72 Andrew Main (Zefram) <zefram@fysh.org>
73
75 Copyright (C) 2006, 2007, 2009, 2010, 2012 Andrew Main (Zefram)
76 <zefram@fysh.org>
77
79 This module is free software; you can redistribute it and/or modify it
80 under the same terms as Perl itself.
81
82
83
84perl v5.32.1 2021-01-26 Authen::Passphrase::MySQL41(3)