1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

cosmetic: minor code style fixes

This commit is contained in:
philsmd 2020-06-13 11:19:00 +02:00
parent 323e7463b8
commit e59f61e8cf
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF
120 changed files with 895 additions and 888 deletions

View File

@ -80,7 +80,6 @@ DECLSPEC void m17400m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u64x a43 = 0; u64x a43 = 0;
u64x a44 = 0; u64x a44 = 0;
#define Rho_Pi(ad,r) \ #define Rho_Pi(ad,r) \
bc0 = ad; \ bc0 = ad; \
ad = hc_rotl64 (t, r); \ ad = hc_rotl64 (t, r); \

View File

@ -80,7 +80,6 @@ DECLSPEC void m17600m (u32 *w0, u32 *w1, u32 *w2, u32 *w3, const u32 pw_len, KER
u64x a43 = 0; u64x a43 = 0;
u64x a44 = 0; u64x a44 = 0;
#define Rho_Pi(ad,r) \ #define Rho_Pi(ad,r) \
bc0 = ad; \ bc0 = ad; \
ad = hc_rotl64 (t, r); \ ad = hc_rotl64 (t, r); \

View File

@ -616,6 +616,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8) for (u32 i = 0; i < contents_hash_len; i++, ptr_data += 8)
sprintf (ptr_data, "%08x", ptr_contents_hash[i]); sprintf (ptr_data, "%08x", ptr_contents_hash[i]);
} }
if (keyfile_len) if (keyfile_len)
{ {
*ptr_data = '*'; *ptr_data = '*';

View File

@ -211,7 +211,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5tgs->account_info; u8 *account_info_ptr = (u8 *) krb5tgs->account_info;
// domain must be uppercase // domain must be uppercase
u8 domain[128]; u8 domain[128];
memcpy (domain, domain_pos, domain_len); memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len); uppercase (domain, domain_len);

View File

@ -211,7 +211,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5tgs->account_info; u8 *account_info_ptr = (u8 *) krb5tgs->account_info;
// domain must be uppercase // domain must be uppercase
u8 domain[128]; u8 domain[128];
memcpy (domain, domain_pos, domain_len); memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len); uppercase (domain, domain_len);

View File

@ -153,7 +153,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5pa->account_info; u8 *account_info_ptr = (u8 *) krb5pa->account_info;
// domain must be uppercase // domain must be uppercase
u8 domain[128]; u8 domain[128];
memcpy (domain, domain_pos, domain_len); memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len); uppercase (domain, domain_len);

View File

@ -153,7 +153,9 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *account_info_ptr = (u8 *) krb5pa->account_info; u8 *account_info_ptr = (u8 *) krb5pa->account_info;
// domain must be uppercase // domain must be uppercase
u8 domain[128]; u8 domain[128];
memcpy (domain, domain_pos, domain_len); memcpy (domain, domain_pos, domain_len);
uppercase (domain, domain_len); uppercase (domain, domain_len);

View File

@ -1084,6 +1084,7 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
{ {
printf (","); printf (",");
} }
printf (" { \"device_id\": %d,", device_id + 1); printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"speed\": %" PRIu64 ",", (u64) (device_info->hashes_msec_dev * 1000)); printf (" \"speed\": %" PRIu64 ",", (u64) (device_info->hashes_msec_dev * 1000));
@ -1883,6 +1884,7 @@ void status_speed_json (hashcat_ctx_t *hashcat_ctx)
printf (" \"speed\": %" PRIu64 " }", (u64) (device_info->hashes_msec_dev_benchmark * 1000)); printf (" \"speed\": %" PRIu64 " }", (u64) (device_info->hashes_msec_dev_benchmark * 1000));
device_num++; device_num++;
} }
printf (" ] }"); printf (" ] }");
status_status_destroy (hashcat_ctx, hashcat_status); status_status_destroy (hashcat_ctx, hashcat_status);

View File

@ -49,4 +49,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -80,4 +80,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -114,4 +114,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -105,4 +105,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -69,4 +69,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -61,4 +61,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -178,4 +178,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -178,4 +178,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -104,4 +104,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -104,4 +104,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -89,4 +89,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -88,4 +88,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -84,4 +84,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -61,7 +61,7 @@ sub module_verify_hash
my $iterbytes = substr $hashbytes, 0, 4; my $iterbytes = substr $hashbytes, 0, 4;
my $iter = unpack('N*', pack('L*', unpack("I",$iterbytes))); my $iter = unpack ('N*', pack ('L*', unpack ('I', $iterbytes)));
my $salt = substr $hashbytes, 4, 64; my $salt = substr $hashbytes, 4, 64;
@ -75,4 +75,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -76,21 +76,27 @@ sub get_random_dpapimk_salt
# Thanks to Jochen Hoenicke <hoenicke@gmail.com> # Thanks to Jochen Hoenicke <hoenicke@gmail.com>
# (one of the authors of Palm Keyring) # (one of the authors of Palm Keyring)
# for these next two subs. # for these next two subs.
sub dpapi_pbkdf2 sub dpapi_pbkdf2
{ {
my ($password, $salt, $iter, $keylen, $prf) = @_; my ($password, $salt, $iter, $keylen, $prf) = @_;
my ($k, $t, $u, $ui, $i); my ($k, $t, $u, $ui, $i);
$t = ""; $t = "";
for ($k = 1; length ($t) < $keylen; $k++) for ($k = 1; length ($t) < $keylen; $k++)
{ {
$u = $ui = &$prf ($salt . pack ('N', $k), $password); $u = $ui = &$prf ($salt . pack ('N', $k), $password);
for ($i = 1; $i < $iter; $i++) for ($i = 1; $i < $iter; $i++)
{ {
# modification to fit Microsoft # modification to fit Microsoft
# weird pbkdf2 implementation... # weird pbkdf2 implementation...
$ui = &$prf ($u, $password); $ui = &$prf ($u, $password);
$u ^= $ui; $u ^= $ui;
} }
$t .= $u; $t .= $u;
} }
return substr ($t, 0, $keylen); return substr ($t, 0, $keylen);

View File

@ -77,23 +77,30 @@ sub get_random_dpapimk_salt
# Thanks to Jochen Hoenicke <hoenicke@gmail.com> # Thanks to Jochen Hoenicke <hoenicke@gmail.com>
# (one of the authors of Palm Keyring) # (one of the authors of Palm Keyring)
# for these next two subs. # for these next two subs.
sub dpapi_pbkdf2 sub dpapi_pbkdf2
{ {
my ($password, $salt, $iter, $keylen, $prf) = @_; my ($password, $salt, $iter, $keylen, $prf) = @_;
my ($k, $t, $u, $ui, $i); my ($k, $t, $u, $ui, $i);
$t = ""; $t = "";
for ($k = 1; length ($t) < $keylen; $k++) for ($k = 1; length ($t) < $keylen; $k++)
{ {
$u = $ui = &$prf ($salt . pack ('N', $k), $password); $u = $ui = &$prf ($salt . pack ('N', $k), $password);
for ($i = 1; $i < $iter; $i++) for ($i = 1; $i < $iter; $i++)
{ {
# modification to fit Microsoft # modification to fit Microsoft
# weird pbkdf2 implementation... # weird pbkdf2 implementation...
$ui = &$prf ($u, $password); $ui = &$prf ($u, $password);
$u ^= $ui; $u ^= $ui;
} }
$t .= $u; $t .= $u;
} }
return substr ($t, 0, $keylen); return substr ($t, 0, $keylen);
} }

View File

@ -74,4 +74,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -240,4 +240,3 @@ sub module_verify_hash
} }
1; 1;

View File

@ -24,7 +24,8 @@ sub module_generate_hash
my $digest = sha256 ($salt . $word); my $digest = sha256 ($salt . $word);
for (my $i = 1; $i < $iter; $i++) { for (my $i = 1; $i < $iter; $i++)
{
$digest = sha256 ($digest); $digest = sha256 ($digest);
} }

View File

@ -9,7 +9,7 @@ use strict;
use warnings; use warnings;
use Digest::MD5 qw (md5_hex); use Digest::MD5 qw (md5_hex);
use File::Basename qw (dirname); use File::Basename qw (dirname);
use YAML::XS "LoadFile"; use YAML::XS qw (LoadFile);
use Test::More; use Test::More;
# Use `eq_or_diff` from Test::Differences if it's available for an easier to read comparison # Use `eq_or_diff` from Test::Differences if it's available for an easier to read comparison