Garry's Mod Wiki

Garry's Mod Wiki

  string util.SHA256( string stringToHash )

Description

Generates the SHA-256 hash of the specified string. This is unique and will never return the same hash for a different string unlike util.CRC or util.MD5 which are both vulnerable to duplicate returns.

Arguments

1 string stringToHash
The string to calculate the SHA-256 hash of.

Returns

1 string
The SHA-256 hash of the string in hexadecimal form.

Example

Prints out an example of how SHA-256 hashes work.

local a, b = util.SHA256("Hello"), util.SHA256("World") print(a == b) print(a, b) print(a == util.SHA256("Hello"))
Output:
false 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969 78ae647dc5544d227130a0682a51e30bc7777fbb6d8a8f17007463a3ecd1d524 true

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...