# llComputeHash

*LSL function*

```lsl
string string llComputeHash(string message, string algorithm);
```

- `string message`: Message string to be hashed.
- `string algorithm`: Cryptographic digest algorithm to use (e.g., md5, sha1, sha224, sha256, sha384, or sha512).

- Returns: `string`
- Energy: 10

Supported values of **algorithm** are **md5**, **md5_sha1**, **sha1**, **sha224**, **sha256**, **sha384**, **sha512**.

Returns a [string](https://wiki.secondlife.com/wiki/string) hex-encoded hash digest of **message** using cryptographic **algorithm**

```lsl title="How to use" frame="terminal"
string result = llComputeHash("", "");
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl collapse={1-18}
default
{
    state_entry()
    {
        llOwnerSay("Ready");
    }

    touch_start(integer touch_count)
    {
        string message = "your-test-message-here";

        list algorithms = ["md5", "md5_sha1", "sha1", "sha224", "sha256", "sha384", "sha512" ];

        integer num_algorithms = llGetListLength(algorithms);
        llOwnerSay("message='" + message + "'");

        integer i = 0;
        for (i = 0; i < num_algorithms; ++i)
        {
            string algorithm = llList2String(algorithms, i);
            string hash = llComputeHash(message, algorithm);
            llOwnerSay(algorithm + " : " + hash);
        }
    }
}
```

</details>

## See also

### Functions

- [llSignRSA](/functions/llSignRSA/)
- [llVerifyRSA](/functions/llVerifyRSA/)
- [llHMAC](/functions/llHMAC/)
- [llSHA1String](/functions/llSHA1String/)
- [llSHA256String](/functions/llSHA256String/)
- [llMD5String](/functions/llMD5String/)

---

*Source: [LlComputeHash](https://wiki.secondlife.com/wiki/LlComputeHash) on the Second Life Wiki. Content from the Second Life Wiki article LlComputeHash (revision 1216083, 2024-01-18), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llComputeHash/
