github.com/kanishk98/terraform@v1.3.0-dev.0.20220917174235-661ca8088a6a/website/docs/language/functions/bcrypt.mdx (about) 1 --- 2 page_title: bcrypt - Functions - Configuration Language 3 description: |- 4 The bcrypt function computes a hash of the given string using the Blowfish 5 cipher. 6 --- 7 8 # `bcrypt` Function 9 10 `bcrypt` computes a hash of the given string using the Blowfish cipher, 11 returning a string in 12 [the _Modular Crypt Format_](https://passlib.readthedocs.io/en/stable/modular_crypt_format.html) 13 usually expected in the shadow password file on many Unix systems. 14 15 ```hcl 16 bcrypt(string, cost) 17 ``` 18 19 The `cost` argument is optional and will default to 10 if unspecified. 20 21 Since a bcrypt hash value includes a randomly selected salt, each call to this 22 function will return a different value, even if the given string and cost are 23 the same. Using this function directly with resource arguments will therefore 24 cause spurious diffs. We recommend using this function only in `provisioner` 25 blocks, or in data resources whose results are only used in `provisioner` 26 blocks. 27 28 The version prefix on the generated string (e.g. `$2a$`) may change in future 29 versions of Terraform. 30 31 ## Examples 32 33 ``` 34 > bcrypt("hello world") 35 $2a$10$D5grTTzcsqyvAeIAnY/mYOIqliCoG7eAMX0/oFcuD.iErkksEbcAa 36 ```