Skip to content

Conversation

@magnumripper
Copy link
Member

Add iterated-sha1 format(s). Optionally salted ($s.$p) and optionally iterated. Actually they can even do raw-sha1 if formatted right!

magnumripper and others added 2 commits November 18, 2025 15:13
salted-sha1 and SSHA512 are ($p.$s)
XSHA and XSHA512 are ($s.$p)
This is optionally salted ($s.$p) and optionally iterated.

Canonical ciphertext: $sisha1$iter$<salt><hash> where salt length can be
1-16 bytes and inferred from total length (note: no field delimiter).

Raw ciphertext: The last of the ciphertext is always the SHA-1 hash and
anything before that is the salt. 4 bytes salt defaults to 1 iteration
(this is XSHA). Other salt lengths default to 1024 iterations.

No salt still means 1024 iterations but you can force this format to
do single raw sha1 using $sisha1$1$<hash> because, well, why not?
Copy link
Member

@solardiz solardiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a full review, but I skimmed.

Where are these hashes used? Why specifically 1024 iterations? Do we need default iteration counts at all, or should we require the field?

int getdec(char *string, char separator)
{
int i = 0;
char buf[11];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use const char * for the argument, and two pointers instead of i.

int i = 0;
char buf[11];

while (string[i] && string[i] >= '0' && string[i] <= '9') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to check string[i] for non-zero if we also do the range check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants