mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 22:58:30 +00:00
Add test module, update name of hash mode 27100
This commit is contained in:
parent
dc662c354e
commit
483a62cb7c
@ -17,7 +17,7 @@ static const u32 DGST_POS2 = 2;
|
||||
static const u32 DGST_POS3 = 1;
|
||||
static const u32 DGST_SIZE = DGST_SIZE_4_5;
|
||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH_SALTED;
|
||||
static const char *HASH_NAME = "sha1(--$salt--$pass--)";
|
||||
static const char *HASH_NAME = "Ruby on Rails Restful Auth (single round, no sitekey)";
|
||||
static const u64 KERN_TYPE = 27100;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_PRECOMPUTE_INIT
|
||||
|
44
tools/test_modules/m27100.pm
Normal file
44
tools/test_modules/m27100.pm
Normal file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
##
|
||||
## Author......: See docs/credits.txt
|
||||
## License.....: MIT
|
||||
##
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::SHA qw (sha1_hex);
|
||||
|
||||
sub module_constraints { [[0, 256], [0, 256], [0, 55], [0, 55], [0, 55]] }
|
||||
|
||||
sub module_generate_hash
|
||||
{
|
||||
my $word = shift;
|
||||
my $salt = shift || random_numeric_string (40);
|
||||
|
||||
my $digest = sha1_hex ('--' . $salt . '--' . $word . '--');
|
||||
|
||||
my $hash = sprintf ("%s:%s", $digest, $salt);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
||||
sub module_verify_hash
|
||||
{
|
||||
my $line = shift;
|
||||
|
||||
my ($hash, $salt, $word) = split (':', $line);
|
||||
|
||||
return unless defined $hash;
|
||||
return unless defined $salt;
|
||||
return unless defined $word;
|
||||
|
||||
my $word_packed = pack_if_HEX_notation ($word);
|
||||
|
||||
my $new_hash = module_generate_hash ($word_packed, $salt);
|
||||
|
||||
return ($new_hash, $word);
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user