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.10 by root, Fri Nov 16 12:14:59 2012 UTC vs.
Revision 1.11 by root, Sat Nov 17 07:11:35 2012 UTC

36sub hash_pw($) { 36sub hash_pw($) {
37 # we primarily want to protect the password itself, and 37 # we primarily want to protect the password itself, and
38 # secondarily want to protect us against pre-image attacks. 38 # secondarily want to protect us against pre-image attacks.
39 # we don't want to overdo it, to keep implementation simple. 39 # we don't want to overdo it, to keep implementation simple.
40 40
41 my $pw = shift; 41 my $pass = substr shift, 0, 512 / 8;
42 42
43 for (0..9) { 43 my $hash; # first iteration is just dgst $pass
44 $pw = "deliantrakdf$_$pw" x 32;
45 $pw = dgst $pw;
46 }
47 44
48 $pw 45 $hash = dgst $hash ^ $pass
46 for 0..9999;
47
48 $hash
49} 49}
50 50
51=item Deliantra::Util::auth_pw $hash, $nonce1, $nonce2 51=item Deliantra::Util::auth_pw $hash, $nonce1, $nonce2
52 52
53Authenticates a (hashed) password using the given nonce. 53Authenticates a (hashed) password using the given nonce.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines