Difference between revisions of "LlMD5String"

From Second Life Wiki
Jump to navigation Jump to search
Line 3: Line 3:
|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 '''src''' with a {{Wikipedia|Salt_%28cryptography%29|salt}} of ":"+'''nonce'''.
|return_text=of 32 hex characters that is the {{Wikipedia|MD5|MD5}} checksum of '''src''' with a {{Wikipedia|Salt_%28cryptography%29|salt}} of ":"+'''nonce'''.
|spec='''nonce''' is casted to string, then appended to '''src''' after a colon ('''src'''+":"+(string)'''nonce''').  This is important to know if you are calculating a hash in another language and wish to compare with one calculated in LSL.
|spec='''nonce''' is casted to string, then appended to '''src''' after a colon ('''src'''+":"+(string)'''nonce''').  This is important to know if you are calculating a hash in another language and wish to compare with one calculated in LSL.
<BR>
<BR>
It is important to note here that '''llMD5String("example",0) != md5("example")''' but,  '''llMD5String("example",0) == md5("example:0")'''
<BR>
<BR>
There is no similar '''md5()''' in LSL, because else LSL whould be to easy. It took me 2 hours to find out, 2 precious hours of my life.


LSL strings are stored in the UTF-8 format.
LSL strings are stored in the UTF-8 format.

Revision as of 15:17, 20 November 2011

Emblem-important-red.png 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 );
0.0 Forced Delay
10.0 Energy

Returns a string of 32 hex characters that is the "Wikipedia logo"MD5 checksum of src with a "Wikipedia logo"salt of ":"+nonce.

• string src
• integer nonce

Specification

nonce is casted to string, then appended to src after a colon (src+":"+(string)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 is important to note here that llMD5String("example",0) != md5("example") but, llMD5String("example",0) == md5("example:0")

There is no similar md5() in LSL, because else LSL whould be to easy. It took me 2 hours to find out, 2 precious hours of my life.

LSL strings are stored in the UTF-8 format.

Examples

<lsl> llSay(0, llMD5String("Hello, Avatar!", 0)); // returns 112abd47ceaae1c05a826828650434a6 </lsl>

Linux Example

$ echo -n 'Hello, Avatar!:0' | openssl md5
112abd47ceaae1c05a826828650434a6

See Also

Functions

•  llSHA1String

Deep Notes

Signature

function string llMD5String( string src, integer nonce );