Capy-Bearer Documentation

password_hash

host call

Capy

function password_hash(password : string) string

Description

password_hash() creates a password encoding with a random salt and current scrypt parameters.

Store the returned value exactly. Do not store an empty result.

The encoding includes its scrypt parameters. Its current parameter prefix is $bearer$scrypt$65536$8$1$. After a successful verification, compare the prefix with the parameters you require. Rehash the known password when the prefixes differ.

Parameters

password : the password to hash

Return Values

a self-contained password encoding, or an empty string on failure

Example

Capy

var encoded := password_hash("correct horse battery staple")
print(encoded != "", "\n")