ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/Deliantra/Util.pm
(Generate patch)

Comparing deliantra/Deliantra/Deliantra/Util.pm (file contents):
Revision 1.6 by root, Fri Nov 16 07:01:32 2012 UTC vs.
Revision 1.7 by root, Fri Nov 16 10:47:34 2012 UTC

16 16
17package Deliantra::Util; 17package Deliantra::Util;
18 18
19use common::sense; 19use common::sense;
20 20
21use Digest::SHA3; 21use Digest::SHA;
22 22
23=item Deliantra::Util::hash_pw $cleartext 23=item Deliantra::Util::hash_pw $cleartext
24 24
25Hashes a cleartext password into the binary password used in the protocol. 25Hashes 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
50sub auth_pw($$$) { 50sub 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines