UNPKG

asp-identity-pw

Version:

Password hash and validation library that is compatible with the default ASP.NET Core Identity framework.

23 lines (22 loc) 1.08 kB
/** * PBKDF2 with HMAC-SHA1, 128-bit salt, 256-bit subkey, 1000 iterations. * Format: { 0x00, salt, subkey } * (See also: SDL crypto guidelines v5.1, Part III) * @param password Hashed password as base64 encoded string */ export declare const hashIdentityPasswordV2: (password: string) => string; /** * PBKDF2 with HMAC-SHA256, 128-bit salt, 256-bit subkey, 10000 iterations. * Format: { 0x01, prf (UInt32), iter count (UInt32), salt length (UInt32), salt, subkey } * (All UInt32s are stored big-endian.) * @param password The password that should be hashed. * @returns Hashed password as base64 encoded string */ export declare const hashIdentityPasswordV3: (password: string) => string; /** * Verifies a password that was hashed using the @see hashPassword function. * @param password The password to verify. * @param hash The hash to verify the password against (in base64 encoding). * @returns True if the password matches the hash, false otherwise. */ export declare const verifyPassword: (password: string, hash: string) => boolean;