Skip to content

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Dec 16, 2025

NOTE: not yet passing test vectors

Information about the scrypt MCF format comes largely from libxcrypt:

https://github.com/besser82/libxcrypt/blob/a74a677/lib/crypt-scrypt.c

The format is somewhat like yescrypt in that it uses a special binary encoding of the parameters which is then serialized as little endian crypt-like Base64 (i.e. ./0123456789ABC..XYZZabc..xyz).

However, scrypt doesn't place the parameters in their own $-delimited field like yescrypt, but instead concatenates them to the salt and shoves the combined params + salt into a single $-delimited field.

Also, where yescrypt uses a variable-width integer encoding, scrypt uses a fixed-width encoding.

@tarcieri tarcieri force-pushed the scrypt/mcf-support branch 3 times, most recently from 1a1ba45 to 2e1a918 Compare December 17, 2025 00:46
@tarcieri
Copy link
Member Author

In case anyone is curious what the problem was with passing the test vectors: like SHA-crypt, the MCF implementation for scrypt passes the Base64 encoded salt to the underlying algorithm, rather than first Base64 decoding it

@tarcieri tarcieri marked this pull request as ready for review December 17, 2025 00:49
@tarcieri tarcieri changed the title [WIP] scrypt: add MCF support scrypt: add MCF support Dec 17, 2025
Information about the scrypt MCF format comes largely from libxcrypt:

https://github.com/besser82/libxcrypt/blob/a74a677/lib/crypt-scrypt.c

The format is somewhat like yescrypt in that it uses a special binary
encoding of the parameters which is then serialized as little endian
crypt-like Base64 (i.e. `./0123456789ABC..XYZZabc..xyz`).

However, scrypt doesn't place the parameters in their own `$`-delimited
field like yescrypt, but instead concatenates them to the salt and
shoves the combined params + salt into a single `$`-delimited field.

Also, where yescrypt uses a variable-width integer encoding, scrypt uses
a fixed-width encoding.
@tarcieri tarcieri merged commit b8f1d16 into master Dec 17, 2025
65 checks passed
@tarcieri tarcieri deleted the scrypt/mcf-support branch December 17, 2025 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants