Name: Anonymous 2009-02-17 4:10
Anyone please post the algorithm to generate 4chan tripcodes. In whatever language you want (or psuedo code)
#### funky tripcode time ###########
# no blank tripcodes plz
if(preg_match("/\#$/", $_POST[name], $match)){
$_POST[name] = preg_replace("/\#$/", "", $_POST[name]);
}
## ## ## Secure tripcodes courtesy of MrVacBob ## ## ##
# tripcode hashing, 2ch-style and modified Wakaba-style
if (preg_match("/\#/", $_POST[name])) {
$_POST[name] = str_replace("","&%%%%%%",$_POST[name]); # otherwise HTML numeric entities screw up explode()!
list ($name,$trip,$sectrip) = str_replace("&%%%%%%", "", explode("#",$_POST[name]));
$_POST[name] = $name;
if ($trip != "") {
$salt = strtr(preg_replace("/[^\.-z]/",".",substr($trip."H.",1,2)),":;<=>?@[\\]^_`","ABCDEFGabcdef");
$trip = substr(crypt($trip, $salt),-10);
}
if ($sectrip != "") {
$sha = base64_encode(pack("H*",sha1($sectrip.SecureSalt())));
$sha = substr($sha,0,15);
$trip .= "#".$sha;
}
}
# End of tripcode section #############################