国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

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

2024-09-04 11:42:38
字體:
供稿:網(wǎng)友

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

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

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

調(diào)用方法:

  1. $TestString = 'www.survivalescaperooms.com'
  2. print SimpleHash($TestString);  
  3. // returns: 1082

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 永丰县| 剑阁县| 凤台县| 信宜市| 扎鲁特旗| 瓦房店市| 双柏县| 昌吉市| 十堰市| 漳州市| 玉山县| 安新县| 浦北县| 灵川县| 白玉县| 广东省| 仁寿县| 娄底市| 永川市| 周口市| 姜堰市| 布尔津县| 七台河市| 瑞金市| 江油市| 肥西县| 兴和县| 通河县| 会宁县| 梅州市| 筠连县| 册亨县| 明星| 镇原县| 玛多县| 芒康县| 云霄县| 邹城市| 汉阴县| 赞皇县| 牙克石市|