github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/sha256.html.md (about)

     1  ---
     2  layout: "functions"
     3  page_title: "sha256 - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-crypto-sha256"
     5  description: |-
     6    The sha256 function computes the SHA256 hash of a given string and encodes it
     7    with hexadecimal digits.
     8  ---
     9  
    10  # `sha256` 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  `sha256` computes the SHA256 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 SHA256 algorithm is applied
    20  as defined in [RFC 4634](https://tools.ietf.org/html/rfc4634). The raw hash is
    21  then encoded to lowercase hexadecimal digits before returning.
    22  
    23  ## Examples
    24  
    25  ```
    26  > sha256("hello world")
    27  b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
    28  ```
    29  
    30  ## Related Functions
    31  
    32  
    33  ## Related Functions
    34  
    35  * [`filesha256`](./filesha256.html) calculates the same hash from
    36    the contents of a file rather than from a string value.
    37  * [`base64sha256`](./base64sha256.html) calculates the same hash but returns
    38    the result in a more-compact Base64 encoding.