… | |
… | |
16 | |
16 | |
17 | package Deliantra::Util; |
17 | package Deliantra::Util; |
18 | |
18 | |
19 | use common::sense; |
19 | use common::sense; |
20 | |
20 | |
21 | use Digest::SHA3; |
21 | use Digest::SHA; |
22 | |
22 | |
23 | =item Deliantra::Util::hash_pw $cleartext |
23 | =item Deliantra::Util::hash_pw $cleartext |
24 | |
24 | |
25 | Hashes a cleartext password into the binary password used in the protocol. |
25 | Hashes a cleartext password into the binary password used in the protocol. |
26 | |
26 | |
… | |
… | |
33 | |
33 | |
34 | my $pw = shift; |
34 | my $pw = shift; |
35 | |
35 | |
36 | for (0..10) { |
36 | for (0..10) { |
37 | $pw = "deliantrakdf$pw" x 32; |
37 | $pw = "deliantrakdf$pw" x 32; |
38 | $pw = Digest::SHA3::sha3_512 $pw; |
38 | $pw = Digest::SHA::sha512 $pw; |
39 | } |
39 | } |
40 | |
40 | |
41 | $pw |
41 | $pw |
42 | } |
42 | } |
43 | |
43 | |
… | |
… | |
49 | |
49 | |
50 | sub auth_pw($$$) { |
50 | sub auth_pw($$$) { |
51 | my ($hash, $nonce1, $nonce2) = @_; |
51 | my ($hash, $nonce1, $nonce2) = @_; |
52 | |
52 | |
53 | # simple HMAC application |
53 | # simple HMAC application |
54 | Digest::SHA3::sha3_512 $nonce1 . Digest::SHA3::sha3_512 $nonce2 . $hash |
54 | Digest::SHA::sha512 $nonce1 . Digest::SHA::sha512 $nonce2 . $hash |
55 | } |
55 | } |
56 | |
56 | |
57 | =back |
57 | =back |
58 | |
58 | |
59 | =head1 AUTHOR |
59 | =head1 AUTHOR |