# keystone.common.password_hashers.scrypt module

class keystone.common.password_hashers.scrypt.Scrypt

  Bases: `PasswordHasher`

  passlib transition class for implementing scrypt password hashing

  static hash(password: bytes, salt_size: int = 16, n: int = 16, r: int = 8, p: int = 1, **kwargs) → str

    Generate password hash string with ident and params

    https://docs.python.org/3/library/hashlib.html#hashlib.scrypt

    Parameters:

      - password (bytes) – Password to be hashed.

      - salt_size (int) – Salt size.

      - n (int) – CPU/Memory cost factor.

      - r (int) – Block size.

      - p (int) – Parallel count.

    Returns:

      String in format $scrypt$ln=logN,r=R,p=P$salt$checksum

  ident_values: set[str] = {'$7$', '$scrypt$'}
  name: str = 'scrypt'
  static verify(password: bytes, hashed: str) → bool

    Verify hashing password would be equal to the hashed value

    Parameters:

      - password (bytes) – Password to verify

      - hashed (string) – Hashed password. Used to extract hashing parameters

    Returns:

      boolean whether hashing password with the same parameters would match hashed value

this page last updated: 2026-06-11 21:52:50

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug