1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 15:18:16 +00:00
hashcat/tools/test_modules/m19100.pm
jsteube 87c24200da Added QNX /etc/shadow hash cracking support
- Added hash-mode 19000 QNX /etc/shadow (MD5)
- Added hash-mode 19100 QNX /etc/shadow (SHA256)
- Added hash-mode 19200 QNX /etc/shadow (SHA512)
Implements #35
2019-02-27 17:53:00 +01:00

66 lines
1.0 KiB
Perl

#!/usr/bin/env perl
##
## Author......: See docs/credits.txt
## License.....: MIT
##
use strict;
use warnings;
use Digest::SHA qw (sha256_hex);
sub module_constraints { [[0, 256], [16, 16], [-1, -1], [-1, -1], [-1, -1]] }
sub module_generate_hash
{
my $word = shift;
my $salt = shift;
my $iter = shift // 1000;
my $data;
$data .= $salt;
$data .= $word x $iter;
$data .= $word;
my $digest = sha256_hex ($data);
my $hash;
if ($iter == 1000)
{
$hash = sprintf ("\@s\@%s\@%s", $digest, $salt);
}
else
{
$hash = sprintf ("\@s,%u\@%s\@%s", $iter, $digest, $salt);
}
return $hash;
}
sub module_verify_hash
{
my $line = shift;
my ($hash, $word) = split (':', $line);
return unless defined $hash;
return unless defined $word;
my (undef, $tag, $digest, $salt) = split (/\@/, $hash);
my ($type, $iter) = split (/\,/, $tag);
return unless ($type eq "s");
my $word_packed = pack_if_HEX_notation ($word);
my $new_hash = module_generate_hash ($word_packed, $salt, $iter);
return ($new_hash, $word);
}
1;