Skip to content
lsl.devlsl.devLSL Dev

LlSHA1String

Looking for the current API? Open the llSHA1String reference →

Return value notes

Returns a string of 40 hex characters that is the SHA-1 security hash of src.

Specification

LSL strings are stored in the UTF-8 format.

Caveats

There's no way to input a zero-byte value into this function, nor any byte value from 128-255, therefore it's currently broken for many purposes (like HMAC-SHA1). The reason is because LSL strings cannot have a unicode null character (U+0000) in them, and LSL has no escape code for the null character (many programming languages use \0 but LSL does not have this feature). llEscapeURL("%00") yields an empty string. As well, inside this function, each character with a Unicode integer value over U+0127 / 007F are dealt with in UTF-8 fashion: in the hex values, 0xC2 is appended to the byte value (hence 0x0080-0x00FF become 0xC280-0xC2FF inside the llSHA1String() routine). A JIRA has been filed for this.

Examples

llSay(0, llSHA1String("Hello, Avatar!")); // returns 2E73318E547AF1B28CC0C96F95DDC9B1EE906B8D

Linux Example

$ echo -n 'Hello, Avatar!' | openssl sha1
2E73318E547AF1B28CC0C96F95DDC9B1EE906B8D

See also: functions

See also: articles

History

  • SVN:1291 r98903 Trunk Initial introduction.
  • SVN:1298 r99021 Branch:OpenAL
Integration into OpenAL branch.

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:Wikipedia

Original shared helper source (conditional wiki logic is not evaluated)
{{#if:{{{1<noinclude>|Pagename</noinclude>}}}|
  {{#ifeq:{{{icon|}}}|no
    | <!--empty-->
    | [[File:Wikipedia-16px.png|16px|alt="Wikipedia logo"]]&thinsp;<!--
-->}}[https://{{#if:{{{lang|}}}|{{{lang|en}}}|{{Langcode|en}}}}.wikipedia.org/wiki/{{urlencode:{{{1}}}|WIKI}} {{{2|{{{1}}}}}}]<!--
-->| {{error|1=Missing page name}}<!--
-->}}<noinclude>
<nowiki>{{Wikipedia|Pagename|display text|icon=no|lang=destination language (currently: </nowiki>{{Langcode|(unknown)}}<nowiki>)}}</nowiki><!--
-->{{Documentation}}</noinclude>

Template:LSL Function/warning

Original shared helper source (conditional wiki logic is not evaluated)
<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{#if:{{#var:fw-multiple}}|{{#vardefine:fw-multiple|{{#expr:{{#var:fw-multiple}}+1}}}}
<span style="font-size:120%;">'''{{{1}}} Warning'''<span>
<div>
{{{2}}}
</div>
|{{#vardefine:header|{{#var:header}}{{#vardefine:fw-multiple|0}}{{#if:{{{2}}}}}{{#vardefine:fw-title|{{{1}}} Warning{{#ifexpr:{{#var:fw-multiple}} > 1|s}}!}}
{{{!}} style="background-color:#AAAAAA; margin-bottom:10px;" cellpadding="3" cellspacing="1"
{{!}} style="background:white;" valign="top" rowspan="2" {{!}} [[Image:Emblem-important-red.png]]
{{!}} style="color:white; background:#990000;" title="{{#var:fw-title}}" width="100%" {{!}} '''{{#var:fw-title}}'''
{{!}}-
{{!}} style="background:#F9F9F9; font-size:90%;" {{!}}
{{{2}}}
{{!}}} }}{{#if:{{{inline|}}}<noinclude>t</noinclude>|{{#var:header}}|{{LSL Injection Test}}}}{{#vardefine:fw-multiple|}}{{#vardefine:fw-title|}}}}

Additional wiki content

LSLC: {{LSLC|Encryption|llSHA1String}}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.