> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# crypt.hash

> Hash les octets d une chaine Lua avec un algorithme crypto library hash pris en charge et renvoie un lowercase hexadecimal digest.

<div className="real-function-page">
  ```lua theme={null}
  crypt.hash(data: string, algorithm?: "sha256" | "sha1" | "sha224" | "sha384" | "sha512" | "md5" | "sha3-224" | "sha3-256" | "sha3-384" | "sha3-512"): string
  ```

  ## Arguments

  <ParamField path={"data"} type={"string"} required>
    Octets de chaine Lua transmis a crypto library HashFilter.
  </ParamField>

  <ParamField path={"algorithm"} type={"\"sha256\" | \"sha1\" | \"sha224\" | \"sha384\" | \"sha512\" | \"md5\" | \"sha3-224\" | \"sha3-256\" | \"sha3-384\" | \"sha3-512\""}>
    Nom d algorithme hash case-sensitive. La valeur par defaut est sha256.
  </ParamField>

  ## Retours

  <ResponseField name={"digest"} type={"string"}>
    Lowercase hexadecimal digest sans prefix ni separators.
  </ResponseField>

  ## Exemple

  Hash les octets d une chaine Lua avec l algorithme par defaut ou un nom pris en charge explicite.

  ```lua theme={null}
  local defaultDigest = crypt.hash("hello world")
  local sha3Digest = crypt.hash("hello world", "sha3-256")

  print(defaultDigest)
  print(sha3Digest)
  ```
</div>
