[GH-ISSUE #906] Implement SAP H #508

Closed
opened 2026-10-14 03:10:48 +07:00 by bsakaguchi · 11 comments
Owner

Originally created by @magnumripper on GitHub (Dec 18, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/906

http://hashcat.net/forum/thread-3804.html

I actually think I have an unpublished version somewhere. I'll dig into it.

Originally created by @magnumripper on GitHub (Dec 18, 2014). Original GitHub issue: https://github.com/openwall/john/issues/906 http://hashcat.net/forum/thread-3804.html I actually think I have an unpublished version somewhere. I'll dig into it.
bsakaguchi 2026-10-14 03:10:48 +07:00
Author
Owner

@magnumripper commented on GitHub (Dec 18, 2014):

I actually think I have an unpublished version somewhere

No, that was something else. We only have the #cat docs

<!-- gh-comment-id:67517684 --> @magnumripper commented on GitHub (Dec 18, 2014): > I actually think I have an unpublished version somewhere No, that was something else. We only have the #cat docs
Author
Owner

@jfoug commented on GitHub (Dec 19, 2014):

Do you have explanation of the algorithm?

<!-- gh-comment-id:67713551 --> @jfoug commented on GitHub (Dec 19, 2014): Do you have explanation of the algorithm?
Author
Owner

@magnumripper commented on GitHub (Dec 19, 2014):

We have that #cat forum link mentioned. That's all.

<!-- gh-comment-id:67714487 --> @magnumripper commented on GitHub (Dec 19, 2014): We have that #cat forum link mentioned. That's all.
Author
Owner

@jfoug commented on GitHub (Dec 20, 2014):

I will add this to pass_gen (looks very simple). This should be a trivial format to add to JtR.

<!-- gh-comment-id:67716271 --> @jfoug commented on GitHub (Dec 20, 2014): I will add this to pass_gen (looks very simple). This should be a trivial format to add to JtR.
Author
Owner

@jfoug commented on GitHub (Dec 20, 2014):

Here is the pass_gen.pl code to make these things:

sub sap_h {
    $salt = get_salt(-16);
    my $mode = "sha1";
    my $iter = 1024;
    if (defined $argmode) {$mode=$argmode;} # must be sha1 sha256 sha384 or sha512
    if (defined $argcontent) {$iter=$argcontent; if ($iter<1||$iter>(1<<32)){$iter=1024}} # must be number from 1 to 2^32
    my $modestr;
    if ($mode eq "sha1") { $modestr = "sha"; }
    elsif ($mode eq "sha256") { $modestr = "SHA256"; }
    elsif ($mode eq "sha384") { $modestr = "SHA384"; }
    elsif ($mode eq "sha512") { $modestr = "SHA512"; }
    else { print "invalid mode used for SAP-H  [$mode] is not valid\n"; exit 0; }
    no strict 'refs';
    my $h = &$mode($_[0].$salt);
    for (my $i = 1; $i < $iter; $i++) {
        $h = &$mode($_[0].$h);
    }
    use strict;
    print "u$u-sapH:{x-is$modestr, $iter}".base64($h.$salt).":$u:0:$_[0]::\n";
}
<!-- gh-comment-id:67722928 --> @jfoug commented on GitHub (Dec 20, 2014): Here is the pass_gen.pl code to make these things: ``` Perl sub sap_h { $salt = get_salt(-16); my $mode = "sha1"; my $iter = 1024; if (defined $argmode) {$mode=$argmode;} # must be sha1 sha256 sha384 or sha512 if (defined $argcontent) {$iter=$argcontent; if ($iter<1||$iter>(1<<32)){$iter=1024}} # must be number from 1 to 2^32 my $modestr; if ($mode eq "sha1") { $modestr = "sha"; } elsif ($mode eq "sha256") { $modestr = "SHA256"; } elsif ($mode eq "sha384") { $modestr = "SHA384"; } elsif ($mode eq "sha512") { $modestr = "SHA512"; } else { print "invalid mode used for SAP-H [$mode] is not valid\n"; exit 0; } no strict 'refs'; my $h = &$mode($_[0].$salt); for (my $i = 1; $i < $iter; $i++) { $h = &$mode($_[0].$h); } use strict; print "u$u-sapH:{x-is$modestr, $iter}".base64($h.$salt).":$u:0:$_[0]::\n"; } ```
Author
Owner

@jfoug commented on GitHub (Dec 20, 2014):

I wish I knew if these signatures were correct:

{x-issha, xxxx}hash.salt    (all hash.salt are encoded in base-64 mime format with trailing '=')
{x-isSHA256, xxxx}hash.salt
{x-isSHA384, xxxx}hash.salt
{x-isSHA512, xxxx}hash.salt

the sha is lower cased, and missing the 1
the others are upper case.

If this is correct, then fine, easy enough. But it would be nice to know for 'real'.

<!-- gh-comment-id:67724114 --> @jfoug commented on GitHub (Dec 20, 2014): I wish I knew if these signatures were correct: ``` {x-issha, xxxx}hash.salt (all hash.salt are encoded in base-64 mime format with trailing '=') {x-isSHA256, xxxx}hash.salt {x-isSHA384, xxxx}hash.salt {x-isSHA512, xxxx}hash.salt ``` the sha is lower cased, and missing the 1 the others are upper case. If this is correct, then fine, easy enough. But it would be nice to know for 'real'.
Author
Owner

@jfoug commented on GitHub (Dec 20, 2014):

8a90090 POC format oSSL only, non OMP and not optimized.
9af5fe3 pass_gen code for this format.

<!-- gh-comment-id:67726525 --> @jfoug commented on GitHub (Dec 20, 2014): 8a90090 POC format oSSL only, non OMP and not optimized. 9af5fe3 pass_gen code for this format.
Author
Owner

@jfoug commented on GitHub (Dec 20, 2014):

I might convert this into a flat dyna format. It probably will be pretty close to same speed, since there are few optimizations I can think of, since the algo is:

sha1($p.$h)

This would require some work, as per #827

<!-- gh-comment-id:67739268 --> @jfoug commented on GitHub (Dec 20, 2014): I might convert this into a flat dyna format. It probably will be pretty close to same speed, since there are few optimizations I can think of, since the algo is: sha1($p.$h) This would require some work, as per #827
Author
Owner

@sickwell commented on GitHub (Mar 23, 2023):

what's up? it's still actual for sap

<!-- gh-comment-id:1481161911 --> @sickwell commented on GitHub (Mar 23, 2023): what's up? it's still actual for sap
Author
Owner

@magnumripper commented on GitHub (Mar 23, 2023):

Probably not unless someone contributes. The POC still seem to exist at 8a90090.

<!-- gh-comment-id:1481184976 --> @magnumripper commented on GitHub (Mar 23, 2023): Probably not unless someone contributes. The POC still seem to exist at 8a90090.
Author
Owner

@sickwell commented on GitHub (Mar 23, 2023):

Tested, seems works instead of hash result presents. "--show" also not helps. How to fix?

Loaded 100 password hashes with 100 different salts (saph, SAP CODVN H (PWDSALTEDHASH) [SHA-1/SHA-2 128/128 SSE4.1 4x2])
Cost 2 (iteration count) is 15000 for all loaded hashes
Press 'q' or Ctrl-C to abort, almost any other key for status
Warning: Only 4 candidates left, minimum 8 needed for performance.
AdminAdmin$$       (?)
<!-- gh-comment-id:1481344037 --> @sickwell commented on GitHub (Mar 23, 2023): Tested, seems works instead of hash result presents. "--show" also not helps. How to fix? ``` Loaded 100 password hashes with 100 different salts (saph, SAP CODVN H (PWDSALTEDHASH) [SHA-1/SHA-2 128/128 SSE4.1 4x2]) Cost 2 (iteration count) is 15000 for all loaded hashes Press 'q' or Ctrl-C to abort, almost any other key for status Warning: Only 4 candidates left, minimum 8 needed for performance. AdminAdmin$$ (?) ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#508
No description provided.