Name: Anonymous 2007-08-15 9:47 ID:rAGjFXj3
What's a good way to generate trip codes like 4chan uses? Taking the user IP as an argument.
strtr or manual comparisons, because PHP does it as a hashmap.
strtr implementation, which is bigger than the constant time required for the straightforward comparison implementation.
$cap = mb_convert_encoding($cap, 'SJIS', 'UTF-8');
$salt = substr($cap . 'H..', 1, 2);
$salt = ereg_replace('[^\.-z]', '.', $salt);
$salt = strtr($salt, ':;<=>?@[\\]^_`', 'ABCDEFGabcdef');
$trip = substr(crypt($cap, $salt), -10);