forked from hashcat/hashcat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm02612.pm
57 lines (36 loc) · 984 Bytes
/
m02612.pm
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
57
#!/usr/bin/env perl
##
## Author......: See docs/credits.txt
## License.....: MIT
##
use strict;
use warnings;
use Digest::MD5 qw (md5_hex);
sub module_constraints { [[0, 256], [0, 223], [0, 55], [1, 23], [-1, -1]] }
sub module_generate_hash
{
my $word = shift;
my $salt = shift;
my $salt_hex = unpack ("H*", $salt);
my $digest = md5_hex (md5_hex ($word) . $salt);
my $hash = sprintf ("\$PHPS\$%s\$%s", $salt_hex, $digest);
return $hash;
}
sub module_verify_hash
{
my $line = shift;
my ($hash, $word) = split (':', $line);
return unless defined $hash;
return unless defined $word;
my @data = split ('\$', $hash);
return unless scalar @data == 4;
shift @data;
my $signature = shift @data;
my $salt = shift @data;
my $digest = shift @data;
return unless ($signature eq "PHPS");
my $word_packed = pack_if_HEX_notation ($word);
my $new_hash = module_generate_hash ($word_packed, $salt);
return ($new_hash, $word);
}
1;