=head1 NAME Deliantra::Util - utility cruft =head1 SYNOPSIS use Deliantra::Util; =head1 DESCRIPTION Various utilities that come in handy when dealing with Deliantra. =over 4 =cut package Deliantra::Util; use Digest::SHA; use Digest::SHA3; =item Deliantra::Util::hash_pw $cleartext Hashes a cleartext password into the binary password used in the protocol. =cut sub hash_pw($) { # we primarily want to protect the password itself, and # secondarily want to protect us against pre-image attacks. # we trust nist, but not a single hahs function, so we # use both sha and sha3 my $pw = shift; for (0..20) { $pw = Digest::SHA3::sha3_512 $pw; $pw = "deliantra$pw" x 32; $pw = Digest::SHA::sha512 $pw; } $pw } =back =head1 AUTHOR Marc Lehmann http://home.schmorp.de/ =cut 1