»bcrypt Function

bcrypt computes a hash of the given string using the Blowfish cipher, returning a string in the Modular Crypt Format usually expected in the shadow password file on many Unix systems.

bcrypt(string, cost)
bcrypt(string, cost)

The cost argument is optional and will default to 10 if unspecified.

Since a bcrypt hash value includes a randomly selected salt, each call to this function will return a different value, even if the given string and cost are the same. Using this function directly with job arguments will therefore cause spurious job updates.

The version prefix on the generated string (e.g. $2a$) may change in future versions of Nomad.


> bcrypt("hello world")
> bcrypt("hello world")$2a$10$D5grTTzcsqyvAeIAnY/mYOIqliCoG7eAMX0/oFcuD.iErkksEbcAa