From: Theron H. <the...@ya...> - 2002-06-01 22:09:21
|
sub generate_80211_key { my($str) = @_; return $1 if $str =~ /^\"(.....)\"$/; return pack('H*', $2) if $str =~ /^(0[Xx]|\$)(..........)$/; $whiten = pack('H*', '16ebad570ff4e3de7d7472e8d2aba6a7'); $h1 = &md5($str . $whiten); # md5z is like md5 but the chaining variables are initialized to 0 $h2 = &md5z($h1); $h3 = &md5z($h2); # Use the first 5 bytes = 40 bits for reduced strength # Or use 13 bytes = 104 bits for almost-full strength return $h3; } __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com |