QQ空间g_tk算法

         public int  getGTK(String str){
	    int hash = 5381; 

	    for(int i = 0, len = str.length(); i < len; ++i){ 
	        hash += (hash << 5) + str.charAt(i); 
	    } 

	    return hash & 0x7fffffff; 
	} 

某些地址后必须带上参数g_tk=getGTK(skey),否则报500错误,这段时间出现的,找了好久才找到是这个原因,泪流满面啊!

你可能感兴趣的:(算法)