|
发表于 2007-1-3 18:35:45
|
显示全部楼层
就是Unicode:
如果是U+0000~U+00FF之间的字符,输出一个字节(低8位)
如果是U+0100~U+FFFF之间的字符,输出两个字节(UTF-16)
可问题出在hex_md5函数仍然是“core_md5(str2binl(s), s.length*chrsz)”
而core_md5的代码是:private static function core_md5(x, len) {
x[len >> 5] |= 0x80 << ((len)%32); x[(((len+64) >>> 9) << 4)+14] = len;
var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878;
for (var i = 0; i<x.length; i += 16) {
var olda = a; var oldb = b; var oldc = c; var oldd = d;
a = md5_ff(a, b, c, d, x[i+0], 7, -680876936);
d = md5_ff(d, a, b, c, x[i+1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i+2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i+3], 22, -1044525330);
该函数直接在x数组中计算MD5的
所以需要将x数组清零 |
|