Difference between revisions of "LlMD5String"
Jump to navigation
Jump to search
m (Convert to string, not to hash) |
Rider Linden (talk | contribs) |
||
(8 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LSL Function | ||
|inject-1={{LSL Function/warning|Security|The MD5 hashing algorithm should not be used because it is too easy to generate collisions (two inputs which result in the same hash). http://www.kb.cert.org/vuls/id/836068}} | |||
|func_id=258|func_sleep=0.0|func_energy=10.0 | |func_id=258|func_sleep=0.0|func_energy=10.0 | ||
|func=llMD5String|return_type=string|p1_type=string|p1_name=src|p2_type=integer|p2_name=nonce | |func=llMD5String|return_type=string|p1_type=string|p1_name=src|p2_type=integer|p2_name=nonce | ||
|func_footnote | |func_footnote | ||
|func_desc | |func_desc | ||
|return_text=of 32 hex characters that is the {{Wikipedia|MD5|MD5}} checksum of | |return_text=of 32 hex characters that is the {{Wikipedia|MD5|MD5}} checksum of {{LSLP|src}} with a {{Wikipedia|salt (cryptography)|salt}} of <code>":"+{{LSLPT|nonce}}</code>. | ||
|spec= | |spec={{LSLP|nonce}} is casted to string, then appended to {{LSLP|src}} after a colon (<code>{{LSLPT|src}} + ":" + {{LSLPT|nonce}}</code>). This is important to know if you are calculating a hash in another language and wish to compare with one calculated in LSL. It could be written as <code>MD5Hash({{LSLPT|src}} + ":" + {{LSLPT|nonce}})</code> | ||
The character encoding used by llMD5String is the UTF-8 format. | |||
|caveats | |caveats | ||
|constants | |constants | ||
|examples= | |examples= | ||
< | <source lang="lsl2"> | ||
llSay(0, llMD5String("Hello, Avatar!", 0)); // returns 112abd47ceaae1c05a826828650434a6 | llSay(0, llMD5String("Hello, Avatar!", 0)); // returns 112abd47ceaae1c05a826828650434a6 | ||
</ | </source> | ||
====Linux Example==== | ====Linux Example==== | ||
< | <source lang="bash"> | ||
$ echo -n 'Hello, Avatar!:0' | openssl md5 | $ echo -n 'Hello, Avatar!:0' | openssl md5 | ||
112abd47ceaae1c05a826828650434a6 | 112abd47ceaae1c05a826828650434a6 | ||
</ | </source> | ||
|helpers | |helpers | ||
|also_functions= | |also_functions= | ||
{{LSL DefineRow||[[llSHA1String]]}} | {{LSL DefineRow||[[llSHA1String]]}} | ||
{{LSL DefineRow||[[llSHA256String]]}} | |||
|also_tests | |also_tests | ||
|also_events | |also_events | ||
Line 31: | Line 33: | ||
|cat3=String | |cat3=String | ||
|cat4 | |cat4 | ||
}}{{LSLC|Encryption|llMD5String}} | }}{{LSLC{{#var:lang}}|Encryption|llMD5String}} |
Latest revision as of 11:25, 16 September 2022
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Security Warning! | |
The MD5 hashing algorithm should not be used because it is too easy to generate collisions (two inputs which result in the same hash). http://www.kb.cert.org/vuls/id/836068 |
Summary
Function: string llMD5String( string src, integer nonce );258 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns a string of 32 hex characters that is the MD5 checksum of src with a salt of ":"+nonce
.
• string | src | |||
• integer | nonce |
Specification
nonce is casted to string, then appended to src after a colon (src + ":" + nonce
). This is important to know if you are calculating a hash in another language and wish to compare with one calculated in LSL. It could be written as MD5Hash(src + ":" + nonce)
The character encoding used by llMD5String is the UTF-8 format.
Caveats
Examples
llSay(0, llMD5String("Hello, Avatar!", 0)); // returns 112abd47ceaae1c05a826828650434a6
Linux Example
$ echo -n 'Hello, Avatar!:0' | openssl md5
112abd47ceaae1c05a826828650434a6
See Also
Functions
• | llSHA1String | |||
• | llSHA256String |