> ## 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

> サポートされている crypto library hash アルゴリズムで Lua string のバイトをハッシュし、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
  ```

  ## 引数

  <ParamField path={"data"} type={"string"} required>
    crypto library HashFilter に渡される Lua string のバイト。
  </ParamField>

  <ParamField path={"algorithm"} type={"\"sha256\" | \"sha1\" | \"sha224\" | \"sha384\" | \"sha512\" | \"md5\" | \"sha3-224\" | \"sha3-256\" | \"sha3-384\" | \"sha3-512\""}>
    Case-sensitive な hash アルゴリズム名。デフォルトは sha256 です。
  </ParamField>

  ## 戻り値

  <ResponseField name={"digest"} type={"string"}>
    prefix や separators のない lowercase hexadecimal digest。
  </ResponseField>

  ## 例

  デフォルトアルゴリズムまたは明示的なサポート名で Lua string のバイトをハッシュします。

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

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