This script is a brute force Perl-Script for sha256 password with a length of 4.You can edit the characters and the length.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#!/usr/bin/perlp use strict; use warnings; use Digest::SHA qw(sha256_hex); °define 'GET_SHA256' 'sha256_hex($cach)' # charactter array my @list = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z); #search hash my $searchhash="f0c929a9e723bc62724e30c7e396e576019dfcb8cfd0a3f264ee5d72e64e49d1"; my $cach; my $res; #1 dimension for my $L1 (@list){ $cach = $L1; $res = GET_SHA256;$res =~ s/n//o;check($res,$cach); } #2 dimension for my $L1 (@list){ for my $L2 (@list){ $cach = $L1.$L2; $res = GET_SHA256;$res =~ s/n//o;check($res,$cach); } } #3 dimension for my $L1 (@list){ for my $L2 (@list){ for my $L3 (@list){ $cach = $L1.$L2.$L3; $res = GET_SHA256;$res =~ s/n//o;check($res,$cach); } } } #4 dimension for my $L1 (@list){ for my $L2 (@list){ for my $L3 (@list){ for my $L4 (@list){ $cach = $L1.$L2.$L3.$L4; $res = GET_SHA256;$res =~ s/n//o;check($res,$cach); } } } } exit(0); sub check{ if(shift eq $searchhash){ print $/.$/.$searchhash."->".shift.$/; exit(1); }else{ #debug print #print $searchhash."->".shift.$/; } } |
Result looks like this :
1 2 3 4 5 |
f0c929a9e723bc62724e30c7e396e576019dfcb8cfd0a3f264ee5d72e64e49d1->perl real 0m2.111s user 0m2.096s sys 0m0.011s |
Don’t try to use this :
1 |
`echo -n "$cach" | sha256sum | cut -d " " -f1` |
its much slower …..