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

首頁 > 編程 > ASP > 正文

asp實現(xiàn)的sha1加密解密代碼(和C#兼容)

2024-05-04 10:59:36
字體:
供稿:網(wǎng)友

在百度找的幾個asp sha1(vbs寫的)加密結(jié)果和asp.net的sha1加密結(jié)果不一樣,asp.net sha1加密完后是40位,網(wǎng)上找的asp sha1加密是64位,還以為asp.net做了截取(如網(wǎng)上的asp的md5機密和asp.net位數(shù)不一樣,是做了截取的問題),但是asp的64位加密結(jié)果并沒有包含asp.net的40位結(jié)果,看來找到的版本和asp.net的加密算法不一樣。
 
最后還是靠翻墻用google找到了一個js版本的sha1加密代碼結(jié)合asp使用后結(jié)果和asp.net的sha1加密一模一樣。。看來技術(shù)類的文字用度娘還是搞不過谷歌啊。。隨便fuck下中國的防火墻。。谷歌也給封了。
 
asp sha1加密源代碼如下,和asp.net的sha1加密結(jié)果一致:

復(fù)制代碼 代碼如下:
<script language="javascript" type="text/javascript" runat="server">
/*
 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
 * in FIPS PUB 180-1
 * Version 2.1a Copyright Paul Johnston 2000 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for details.
 */
/*
 * Configurable variables. You may need to tweak these to be compatible with
 * the server-side, but the defaults work in most cases.
 */
var hexcase = 0;  /* hex output format. 0 - lowercase; 1 - uppercase        */
var b64pad  = "="; /* base-64 pad character. "=" for strict RFC compliance   */
var chrsz   = 8;  /* bits per input character. 8 - ASCII; 16 - Unicode      */
/*
 * These are the functions you'll usually want to call
 * They take string arguments and return either hex or base-64 encoded strings
 */
function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}
function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}
function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}
function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}
/*
 * Perform a simple self-test to see if the VM is working
 */
function sha1_vm_test()
{
  return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
}
/*
 * Calculate the SHA-1 of an array of big-endian words, and a bit length
 */
function core_sha1(x, len)
{
  /* append padding */
  x[len >> 5] |= 0x80 << (24 - len % 32);
  x[((len + 64 >> 9) << 4) + 15] = len;
  var w = Array(80);

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 婺源县| 锦屏县| 泸溪县| 浏阳市| 茌平县| 封丘县| 青浦区| 平南县| 额尔古纳市| 五原县| 平陆县| 土默特右旗| 乐都县| 鸡泽县| 响水县| 东乌珠穆沁旗| 古蔺县| 衡阳县| 内黄县| 阿鲁科尔沁旗| 兴安盟| 广元市| 甘泉县| 松江区| 南木林县| 安仁县| 喜德县| 武邑县| 喀喇沁旗| 凌海市| 富裕县| 深圳市| 抚顺县| 边坝县| 文山县| 洛宁县| 红河县| 梁平县| 类乌齐县| 红河县| 永城市|