#!perl -w use strict; #use Digest::CRC qw(crc16); use Digest::MD5 qw(md5); sub digest { return unpack("v", md5(pack("v", shift))); } # example calculating and using rainbow tables # http://www.ethicalhacker.net/content/view/94/24/ # http://www.antsight.com/zsl/rainbowcrack/ my %x; my $c=0; for (my $i=0 ; $i<65536 ; $i++) { next if exists $x{$i}; my $j= $i; printf("-----%04x\n", $i); while (!exists $x{$j}) { $x{$j}{chain}= $c; my $n= digest($j); $x{$j}{next}= $n; $j= $n; printf("%04x\n", $j); } $c++; } printf("c=%d\n", $c); # generate table with: # # endhash -> starthash such that crypt ... crypt(starthash ) = endhash sub genrainbow { my ($c, $chainlen)= @_; }