forked from hashcat/hashcat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm00141.pm
58 lines (38 loc) · 1.14 KB
/
m00141.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
58
#!/usr/bin/env perl
##
## Author......: See docs/credits.txt
## License.....: MIT
##
use strict;
use warnings;
use Digest::SHA1 qw (sha1);
use MIME::Base64 qw (encode_base64 decode_base64);
use Encode;
sub module_constraints { [[0, 256], [0, 256], [0, 27], [0, 27], [0, 27]] }
sub module_generate_hash
{
my $word = shift;
my $salt = shift;
my $digest = sha1 ($salt . encode ("UTF-16LE", $word));
my $base64_salt_buf = encode_base64 ($salt, "");
my $base64_hash_buf = encode_base64 ($digest, "");
$base64_hash_buf = substr ($base64_hash_buf, 0, 27);
my $hash = sprintf ("\$episerver\$*0*%s*%s", $base64_salt_buf, $base64_hash_buf);
return $hash;
}
sub module_verify_hash
{
my $line = shift;
my ($digest, $word) = split (':', $line);
$digest = substr ($digest, 14);
my ($base64_salt, $base64_hash) = split ('\*', $digest);
my $hash = decode_base64 ($base64_hash);
my $salt = decode_base64 ($base64_salt);
return unless defined $hash;
return unless defined $salt;
return unless defined $word;
$word = pack_if_HEX_notation ($word);
my $new_hash = module_generate_hash ($word, $salt);
return ($new_hash, $word);
}
1;