github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/sha1.html.md (about) 1 --- 2 layout: "functions" 3 page_title: "sha1 - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-crypto-sha1" 5 description: |- 6 The sha1 function computes the SHA1 hash of a given string and encodes it 7 with hexadecimal digits. 8 --- 9 10 # `sha1` Function 11 12 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 13 earlier, see 14 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 15 16 `sha1` computes the SHA1 hash of a given string and encodes it with 17 hexadecimal digits. 18 19 The given string is first encoded as UTF-8 and then the SHA1 algorithm is applied 20 as defined in [RFC 3174](https://tools.ietf.org/html/rfc3174). The raw hash is 21 then encoded to lowercase hexadecimal digits before returning. 22 23 Collision attacks have been successfully performed against this hashing 24 function. Before using this function for anything security-sensitive, review 25 relevant literature to understand the security implications. 26 27 ## Examples 28 29 ``` 30 > sha1("hello world") 31 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed 32 ``` 33 34 ## Related Functions 35 36 * [`filesha1`](./filesha1.html) calculates the same hash from 37 the contents of a file rather than from a string value.