llSHA256String
string llSHA256String(string text)Returns a string of 64 hex characters that is the SHA256 security hash of text.
Parameters
-
text(string)
llSay(0, llSHA256String("Hello, Avatar!")); // returns 3a9f9d2e4360319a62139d19bd425c16fb8439b832d74d5221ca75b54c35b4f2Linux Verification
Section titled “Linux Verification”You can verify SHA-256 hashes using OpenSSL:
$ echo -n 'Hello, Avatar!' | openssl sha2563a9f9d2e4360319a62139d19bd425c16fb8439b832d74d5221ca75b54c35b4f2Caveats
Section titled “Caveats”- There is no way to input a zero-byte value into this function, nor any byte value from 128-255, making it currently broken for many purposes (like HMAC-SHA1).
- LSL strings cannot contain a Unicode null character (U+0000), and LSL has no escape code for the null character (unlike many programming languages that use
\0). llEscapeURL("%00")yields an empty string, providing no workaround.- Characters with a Unicode integer value over U+0127 (127 decimal) are handled in UTF-8 fashion: in the hex values,
0xC2is prepended to the byte value (hence0x0080-0x00FFbecome0xC280-0xC2FFinside the function).
LSL strings are stored in UTF-8 format, which affects how byte values are encoded when passed to this function.
Prior to this function’s availability, the only way to get a SHA-256 hash was to use the LSL SHA-256 port implementation.
See Also
Section titled “See Also”- llMD5String
- llSHA1String
- SHA-2