亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

php自定義hash函數(shù)實(shí)例

 更新時(shí)間:2015年05月05日 09:16:05   作者:企鵝不笨  
這篇文章主要介紹了php自定義hash函數(shù),實(shí)例分析了hash函數(shù)的實(shí)現(xiàn)技巧,可實(shí)現(xiàn)簡單的加密功能,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了php自定義hash函數(shù)實(shí)現(xiàn)方法。分享給大家供大家參考。具體分析如下:

這里演示php實(shí)現(xiàn)的一個(gè)簡單hash算法,可以用來加密,不過這個(gè)函數(shù)過于簡單,不能用來解密

function SimpleHash($str){  
  $n = 0;
  // The magic happens here:
  // I just loop trough all letters and add the
  // ASCII value to a integer variable. 
  for ($c=0; $c < strlen($str); $c++)
    $n += ord($str[$c]);
  // After we went trough all letters
  // we have a number that represents the
  // content of the string
  return $n;
}

調(diào)用方法:

$TestString = 'chabaoo.cn';
print SimpleHash($TestString); 
// returns: 1082

希望本文所述對大家的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論