Crypto Testing
    Preparing search index...

    Function mockHashPassword

    • Instant mock of hashPassword that returns a deterministic result without performing any real Argon2 computation.

      The "hash" is simply the SHA-256-style hex of the password XOR'd with a fixed salt, suitable for testing control flow only.

      Parameters

      • password: string | Uint8Array<ArrayBufferLike>

      Returns MockHashPasswordResult

      import { mockHashPassword } from "@sebastienrousseau/crypto-testing";

      const result = mockHashPassword("my-password");
      console.log(result.hash); // deterministic hex string
      console.log(result.phc); // PHC-format string