QQ空间g_tk加密算法PHP版
01.//G_tk计算02.functiongetGTK($skey){03.$hash= 5381;04.for($i=0;$i<strlen($skey);++$i){05.$hash+= ($hash<< 5) + utf8_unicode($skey[$i]);06.}07.return$hash& 0x7fffffff;08.}09.functionutf8_unicode($c) { 10.switch(strlen($c)) { 11.case1: 12.returnord($c); 13.case2: 14.$n= (ord($c[0]) & 0x3f) << 6; 15.$n+= ord($c[1]) & 0x3f; 16.return$n; 17.case3: 18.$n= (ord($c[0]) & 0x1f) << 12; 19.$n+= (ord($c[1]) & 0x3f) << 6; 20.$n+= ord($c[2]) & 0x3f; 21.return$n; 22.case4: 23.$n= (ord($c[0]) & 0x0f) << 18; 24.$n+= (ord($c[1]) & 0x3f) << 12; 25.$n+= (ord($c[2]) & 0x3f) << 6; 26.$n+= ord($c[3]) & 0x3f; 27.return$n; 28.} 29.}
除非特别声明,PHP100新闻均为原创或投稿报道,转载请注明作者及原文链接
原文地址:http://www.php100.com/html/php/hanshu/2013/0923/6224.html











滇公网安备 53230102000482号