Difference between revisions of "32bit Hash"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
m (Replaced <source> with <syntaxhighlight>)
 
Line 2: Line 2:
Here's a function to turn an UUID into an integer.
Here's a function to turn an UUID into an integer.


<source lang="lsl2">
<syntaxhighlight lang="lsl2">
integer Key2Integer(string inkey)
integer Key2Integer(string inkey)
{
{
     return (integer)("0x" + llGetSubString(llMD5String(inkey,0), 0, 7));   
     return (integer)("0x" + llGetSubString(llMD5String(inkey,0), 0, 7));   
}
}
</source>
</syntaxhighlight>


Note: The [[Seedable_PRNG]] example presents MD5 of MD5 of MD5 of ... as pseudo-random numbers
Note: The [[Seedable_PRNG]] example presents MD5 of MD5 of MD5 of ... as pseudo-random numbers


{{LSLC|Examples|32bit Hash}}
{{LSLC|Examples|32bit Hash}}

Latest revision as of 10:53, 6 December 2022

Here's a function to turn an UUID into an integer.

integer Key2Integer(string inkey)
{
    return (integer)("0x" + llGetSubString(llMD5String(inkey,0), 0, 7));   
}

Note: The Seedable_PRNG example presents MD5 of MD5 of MD5 of ... as pseudo-random numbers