Skip to content

crypt(3) support broken #5

@MartinNowak

Description

@MartinNowak
  1. crypt does not use Base64, hence providing a crypt hash to parseHash fails with a Base64 exception
    Crypt uses it's own keymap (see e.g. here).

  2. crypt transposes the hash bytes before encoding them (see sha512-crypt.c, sha256-crypt.c, and md5-crypt.c).

  3. parseHash does not handle $round=10000$ parameters as 2nd component

You might want to add the following test case

$6$rounds=10000$tGiXIng0KHBPBHhk$84T63BF34OMoG4TeoGV7ReJ/U/OAtfa9iFOXQ/Wsd4s3N2wBcdUCPllpkzgYbFfagBcIZxyjqcfvL.KjdiBFJ1

which encrypts the password mypass.
Also passlib might be a useful inspiration for a correct implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions