View Single Post
12-10-05, 08:17 PM   #9
Aquendyn
A Deviate Faerie Dragon
Join Date: Sep 2005
Posts: 12
a 1600-letter string takes about 8ms to hash. 400 letters about 2ms. everything used by the hashing function is garbage-collectible.

to rephrase what Elkano just said. someone unimportant talks to you again, but you didn't save his info. however, because his hash will always be the same, you might recognize him just from the color. if it was random, the color will be different, making it harder to recognize him. you might save his color for this session, but you don't really care for him enough to save it into SavedVars.

the digest (hash) is 32 hex digits. you can use 8 letters each for red, green, blue, and alpha. like this:
PHP Code:
function htocol(hash)
    -- 
color values between 0 and 1
    local c
={};
    
local m=md5.ff; --local m=tonumber('ffffffff',16);
    
c.red=tonumber(strsub(hash,1,8),16)/m;
    
c.green=tonumber(strsub(hash,9,16),16)/m;
    
c.blue=tonumber(strsub(hash,17,24),16)/m;
    
c.alpha=tonumber(strsub(hash,25,32),16)/m;
    return 
c;
end 
  Reply With Quote