github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/crypto/bcrypt.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: bcrypt - Functions - Configuration Language
     4  description: |-
     5    The bcrypt function computes a hash of the given string using the Blowfish
     6    cipher.
     7  ---
     8  
     9  # `bcrypt` Function
    10  
    11  `bcrypt` computes a hash of the given string using the Blowfish cipher,
    12  returning a string in [the _Modular Crypt
    13  Format_](https://passlib.readthedocs.io/en/stable/modular_crypt_format.html)
    14  usually expected in the shadow password file on many Unix systems.
    15  
    16  ```hcl
    17  bcrypt(string, cost)
    18  ```
    19  
    20  The `cost` argument is optional and will default to 10 if unspecified.
    21  
    22  Since a bcrypt hash value includes a randomly selected salt, each call to this
    23  function will return a different value, even if the given string and cost are
    24  the same. Using this function directly with job arguments will therefore
    25  cause spurious job updates.
    26  
    27  The version prefix on the generated string (e.g. `$2a$`) may change in future
    28  versions of Nomad.
    29  
    30  ## Examples
    31  
    32  ```shell-session
    33  > bcrypt("hello world")
    34  $2a$10$D5grTTzcsqyvAeIAnY/mYOIqliCoG7eAMX0/oFcuD.iErkksEbcAa
    35  ```