|
bw070
中级用户
  
积分 292
发帖 137
注册 2007-4-3
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
寒~ 下2个QQ 一个腾迅的 一个珊瑚虫的 不就搞定了么??
我就是这样的...
Han~ Just download two QQs, one from Tencent and one from Shanhuhong, isn't that done?? I'm just like this...
|
|
2007-4-20 11:38 |
|
|
vsda2008
初级用户
 
积分 34
发帖 15
注册 2007-3-25
状态 离线
|
『第 17 楼』:
密码怎么转化阿
使用 LLM 解释/回答一下
密码怎么转化阿 密码怎么转化阿
How to convert the password? How to convert the password?
|
|
2007-4-20 12:52 |
|
|
my3439955
中级用户
  
积分 272
发帖 99
注册 2006-6-2
状态 离线
|
『第 18 楼』:
使用 LLM 解释/回答一下
密码先做md5转换再做Base64变换,Base64或许你可以口算出来,md5就不可能了,还是要使用工具来变换才行啊,10楼提供了工具了
First, convert the password using MD5, then transform it using Base64. Maybe you can calculate Base64 mentally, but MD5 is impossible; you still need to use a tool to transform it. The tool is provided on the 10th floor.
|

X5O!P%@AP |
|
2007-4-21 00:27 |
|
|
vsda2008
初级用户
 
积分 34
发帖 15
注册 2007-3-25
状态 离线
|
『第 19 楼』:
怎么用 md5 + base64 生成 PWDHASH: 后的密码阿
使用 LLM 解释/回答一下
怎么用 md5 + base64 生成 PWDHASH: 后的密码阿
How to generate the password after PWDHASH using MD5 + base64?
|
|
2007-4-21 06:45 |
|
|
luowei144
初级用户
 
积分 57
发帖 28
注册 2007-4-21
状态 离线
|
|
2007-4-21 11:17 |
|
|
vsda2008
初级用户
 
积分 34
发帖 15
注册 2007-3-25
状态 离线
|
『第 21 楼』:
Base64变换
使用 LLM 解释/回答一下
md5 弄 可是 base64 弄不成 我生成的密码不能用
那工具 我下了 可是我是想知道 怎么换!
那位朋友 可以指教下 我的base64 工具 好像 算出来不对
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Base64编码加密</title>
</head>
<body>
<table width="773" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<script language=javascript>
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
function base64encode(str) {
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while(i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if(i == len)
{
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if(i == len)
{
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
out += base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
}
function base64decode(str) {
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0;
out = "";
while(i < len) {
/* c1 */
do {
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while(i < len && c1 == -1);
if(c1 == -1)
break;
/* c2 */
do {
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while(i < len && c2 == -1);
if(c2 == -1)
break;
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) & 0xff;
if(c3 == 61)
return out;
c3 = base64DecodeChars[c3];
} while(i < len && c3 == -1);
if(c3 == -1)
break;
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) & 0xff;
if(c4 == 61)
return out;
c4 = base64DecodeChars[c4];
} while(i < len && c4 == -1);
if(c4 == -1)
break;
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
}
function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
function utf8to16(str) {
var out, i, len, c;
var char2, char3;
out = "";
len = str.length;
i = 0;
while(i < len) {
c = str.charCodeAt(i++);
switch(c >> 4)
{
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
// 0xxxxxxx
out += str.charAt(i-1);
break;
case 12: case 13:
// 110x xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
char3 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x0F) << 12) |
((char2 & 0x3F) << 6) |
((char3 & 0x3F) << 0));
break;
}
}
return out;
}
function doit() {
var f = document.f
f.output.value = base64encode(utf16to8(f.source.value))
f.decode.value = utf8to16(base64decode(f.output.value))
}
</script>
<H1 align="center">Base64编码加密
</H1>
<FORM NAME="f">
原码<BR>
<TEXTAREA NAME="source" ROWS=4 COLS=60 WRAP="soft"></TEXTAREA><BR><BR>
Base64 encode<BR>
<TEXTAREA NAME="output" ROWS=4 COLS=60 WRAP="soft"></TEXTAREA><BR><BR>
Base64 decode<BR>
<TEXTAREA NAME="decode" ROWS=4 COLS=60 WRAP="soft"></TEXTAREA><BR><BR>
<INPUT TYPE=BUTTON VALUE="转换" ONCLICK="doit()">
</FORM>
</td>
</tr>
</table>
</body>
</html>
md5 can be done, but base64 can't. The password I generated doesn't work. I downloaded that tool, but I just want to know how to change it! Could some friend give me some advice? My base64 tool seems to calculate incorrectly.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Base64 Encoding and Encryption</title>
</head>
<body>
<table width="773" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<script language=javascript>
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
function base64encode(str) {
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while(i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if(i == len)
{
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if(i == len)
{
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
out += base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
}
function base64decode(str) {
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0;
out = "";
while(i < len) {
/* c1 */
do {
c1 = base64DecodeChars;
} while(i < len && c1 == -1);
if(c1 == -1)
break;
/* c2 */
do {
c2 = base64DecodeChars;
} while(i < len && c2 == -1);
if(c2 == -1)
break;
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) & 0xff;
if(c3 == 61)
return out;
c3 = base64DecodeChars;
} while(i < len && c3 == -1);
if(c3 == -1)
break;
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) & 0xff;
if(c4 == 61)
return out;
c4 = base64DecodeChars;
} while(i < len && c4 == -1);
if(c4 == -1)
break;
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
}
function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
function utf8to16(str) {
var out, i, len, c;
var char2, char3;
out = "";
len = str.length;
i = 0;
while(i < len) {
c = str.charCodeAt(i++);
switch(c >> 4)
{
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
// 0xxxxxxx
out += str.charAt(i-1);
break;
case 12: case 13:
// 110x xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
char3 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x0F) << 12) |
((char2 & 0x3F) << 6) |
((char3 & 0x3F) << 0));
break;
}
}
return out;
}
function doit() {
var f = document.f
f.output.value = base64encode(utf16to8(f.source.value))
f.decode.value = utf8to16(base64decode(f.output.value))
}
</script>
<H1 align="center">Base64 Encoding and Encryption
</H1>
<FORM NAME="f">
Original Code<BR>
<TEXTAREA NAME="source" ROWS=4 COLS=60 WRAP="soft"></TEXTAREA><BR><BR>
Base64 encode<BR>
<TEXTAREA NAME="output" ROWS=4 COLS=60 WRAP="soft"></TEXTAREA><BR><BR>
Base64 decode<BR>
<TEXTAREA NAME="decode" ROWS=4 COLS=60 WRAP="soft"></TEXTAREA><BR><BR>
<INPUT TYPE=BUTTON VALUE="Convert" ONCLICK="doit()">
</FORM>
</td>
</tr>
</table>
</body>
</html>
|
|
2007-4-21 11:18 |
|
|
my3439955
中级用户
  
积分 272
发帖 99
注册 2006-6-2
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
javascript不是很懂,用它做Base64和md5应该没问题,网上找了些资料,可以实现md5+base64变换,以下是一个完整的网页
<HTML>
<HEAD>
<META http-equiv=Content-Type content=text/html; charset=gb2312>
<TITLE>JavaScript的md5加密办法</TITLE>
</HEAD>
<BODY >
<input id=test value=>
<input type=button value=md5 onclick="alert(hex_md5(test.value))">
<input type=button value=md5+Base64 onclick="alert(b64_md5(test.value))">
<script>
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 */
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function calcMD5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function md5_vm_test()
{
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}
function core_md5(x, len)
{
x |= 0x80 << ((len) % 32);
x = 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, 7 , -680876936);
d = md5_ff(d, a, b, c, x, 12, -389564586);
c = md5_ff(c, d, a, b, x, 17, 606105819);
b = md5_ff(b, c, d, a, x, 22, -1044525330);
a = md5_ff(a, b, c, d, x, 7 , -176418897);
d = md5_ff(d, a, b, c, x, 12, 1200080426);
c = md5_ff(c, d, a, b, x, 17, -1473231341);
b = md5_ff(b, c, d, a, x, 22, -45705983);
a = md5_ff(a, b, c, d, x, 7 , 1770035416);
d = md5_ff(d, a, b, c, x, 12, -1958414417);
c = md5_ff(c, d, a, b, x, 17, -42063);
b = md5_ff(b, c, d, a, x, 22, -1990404162);
a = md5_ff(a, b, c, d, x, 7 , 1804603682);
d = md5_ff(d, a, b, c, x, 12, -40341101);
c = md5_ff(c, d, a, b, x, 17, -1502002290);
b = md5_ff(b, c, d, a, x, 22, 1236535329);
a = md5_gg(a, b, c, d, x, 5 , -165796510);
d = md5_gg(d, a, b, c, x, 9 , -1069501632);
c = md5_gg(c, d, a, b, x, 14, 643717713);
b = md5_gg(b, c, d, a, x, 20, -373897302);
a = md5_gg(a, b, c, d, x, 5 , -701558691);
d = md5_gg(d, a, b, c, x, 9 , 38016083);
c = md5_gg(c, d, a, b, x, 14, -660478335);
b = md5_gg(b, c, d, a, x, 20, -405537848);
a = md5_gg(a, b, c, d, x, 5 , 568446438);
d = md5_gg(d, a, b, c, x, 9 , -1019803690);
c = md5_gg(c, d, a, b, x, 14, -187363961);
b = md5_gg(b, c, d, a, x, 20, 1163531501);
a = md5_gg(a, b, c, d, x, 5 , -1444681467);
d = md5_gg(d, a, b, c, x, 9 , -51403784);
c = md5_gg(c, d, a, b, x, 14, 1735328473);
b = md5_gg(b, c, d, a, x, 20, -1926607734);
a = md5_hh(a, b, c, d, x, 4 , -378558);
d = md5_hh(d, a, b, c, x, 11, -2022574463);
c = md5_hh(c, d, a, b, x, 16, 1839030562);
b = md5_hh(b, c, d, a, x, 23, -35309556);
a = md5_hh(a, b, c, d, x, 4 , -1530992060);
d = md5_hh(d, a, b, c, x, 11, 1272893353);
c = md5_hh(c, d, a, b, x, 16, -155497632);
b = md5_hh(b, c, d, a, x, 23, -1094730640);
a = md5_hh(a, b, c, d, x, 4 , 681279174);
d = md5_hh(d, a, b, c, x, 11, -358537222);
c = md5_hh(c, d, a, b, x, 16, -722521979);
b = md5_hh(b, c, d, a, x, 23, 76029189);
a = md5_hh(a, b, c, d, x, 4 , -640364487);
d = md5_hh(d, a, b, c, x, 11, -421815835);
c = md5_hh(c, d, a, b, x, 16, 530742520);
b = md5_hh(b, c, d, a, x, 23, -995338651);
a = md5_ii(a, b, c, d, x, 6 , -198630844);
d = md5_ii(d, a, b, c, x, 10, 1126891415);
c = md5_ii(c, d, a, b, x, 15, -1416354905);
b = md5_ii(b, c, d, a, x, 21, -57434055);
a = md5_ii(a, b, c, d, x, 6 , 1700485571);
d = md5_ii(d, a, b, c, x, 10, -1894986606);
c = md5_ii(c, d, a, b, x, 15, -1051523);
b = md5_ii(b, c, d, a, x, 21, -2054922799);
a = md5_ii(a, b, c, d, x, 6 , 1873313359);
d = md5_ii(d, a, b, c, x, 10, -30611744);
c = md5_ii(c, d, a, b, x, 15, -1560198380);
b = md5_ii(b, c, d, a, x, 21, 1309151649);
a = md5_ii(a, b, c, d, x, 6 , -145523070);
d = md5_ii(d, a, b, c, x, 10, -1120210379);
c = md5_ii(c, d, a, b, x, 15, 718787259);
b = md5_ii(b, c, d, a, x, 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return Array(a, b, c, d);
}
function md5_cmn(q, a, b, x, s, t)
{
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
function core_hmac_md5(key, data)
{
var bkey = str2binl(key);
if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad = bkey ^ 0x36363636;
opad = bkey ^ 0x5C5C5C5C;
}
var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
return core_md5(opad.concat(hash), 512 + 128);
}
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
function bit_rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
function str2binl(str)
{
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
return bin;
}
function binl2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray >> ((i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray >> ((i%4)*8 )) & 0xF);
}
return str;
}
function binl2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray >> 8 * ( i %4)) & 0xFF) << 16)
| (((binarray >> 8 * ((i+1)%4)) & 0xFF) << 8 )
| ((binarray >> 8 * ((i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}
</script>
</BODY>
</HTML>
更改了一点 现在可以产生出正确的可用的md5+base64值
Last edited by my3439955 on 2007-4-28 at 11:21 AM ]
I don't understand JavaScript very well, but it should be okay to use it to do Base64 and md5. I found some information online and can implement md5+base64 transformation. The following is a complete web page
<HTML>
<HEAD>
<META http-equiv=Content-Type content=text/html; charset=gb2312>
<TITLE>JavaScript的md5加密办法</TITLE>
</HEAD>
<BODY >
<input id=test value=>
<input type=button value=md5 onclick="alert(hex_md5(test.value))">
<input type=button value=md5+Base64 onclick="alert(b64_md5(test.value))">
<script>
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 */
function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function calcMD5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function md5_vm_test()
{
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}
function core_md5(x, len)
{
x |= 0x80 << ((len) % 32);
x = 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, 7 , -680876936);
d = md5_ff(d, a, b, c, x, 12, -389564586);
c = md5_ff(c, d, a, b, x, 17, 606105819);
b = md5_ff(b, c, d, a, x, 22, -1044525330);
a = md5_ff(a, b, c, d, x, 7 , -176418897);
d = md5_ff(d, a, b, c, x, 12, 1200080426);
c = md5_ff(c, d, a, b, x, 17, -1473231341);
b = md5_ff(b, c, d, a, x, 22, -45705983);
a = md5_ff(a, b, c, d, x, 7 , 1770035416);
d = md5_ff(d, a, b, c, x, 12, -1958414417);
c = md5_ff(c, d, a, b, x, 17, -42063);
b = md5_ff(b, c, d, a, x, 22, -1990404162);
a = md5_ff(a, b, c, d, x, 7 , 1804603682);
d = md5_ff(d, a, b, c, x, 12, -40341101);
c = md5_ff(c, d, a, b, x, 17, -1502002290);
b = md5_ff(b, c, d, a, x, 22, 1236535329);
a = md5_gg(a, b, c, d, x, 5 , -165796510);
d = md5_gg(d, a, b, c, x, 9 , -1069501632);
c = md5_gg(c, d, a, b, x, 14, 643717713);
b = md5_gg(b, c, d, a, x, 20, -373897302);
a = md5_gg(a, b, c, d, x, 5 , -701558691);
d = md5_gg(d, a, b, c, x, 9 , 38016083);
c = md5_gg(c, d, a, b, x, 14, -660478335);
b = md5_gg(b, c, d, a, x, 20, -405537848);
a = md5_gg(a, b, c, d, x, 5 , 568446438);
d = md5_gg(d, a, b, c, x, 9 , -1019803690);
c = md5_gg(c, d, a, b, x, 14, -187363961);
b = md5_gg(b, c, d, a, x, 20, 1163531501);
a = md5_gg(a, b, c, d, x, 5 , -1444681467);
d = md5_gg(d, a, b, c, x, 9 , -51403784);
c = md5_gg(c, d, a, b, x, 14, 1735328473);
b = md5_gg(b, c, d, a, x, 20, -1926607734);
a = md5_hh(a, b, c, d, x, 4 , -378558);
d = md5_hh(d, a, b, c, x, 11, -2022574463);
c = md5_hh(c, d, a, b, x, 16, 1839030562);
b = md5_hh(b, c, d, a, x, 23, -35309556);
a = md5_hh(a, b, c, d, x, 4 , -1530992060);
d = md5_hh(d, a, b, c, x, 11, 1272893353);
c = md5_hh(c, d, a, b, x, 16, -155497632);
b = md5_hh(b, c, d, a, x, 23, -1094730640);
a = md5_hh(a, b, c, d, x, 4 , 681279174);
d = md5_hh(d, a, b, c, x, 11, -358537222);
c = md5_hh(c, d, a, b, x, 16, -722521979);
b = md5_hh(b, c, d, a, x, 23, 76029189);
a = md5_hh(a, b, c, d, x, 4 , -640364487);
d = md5_hh(d, a, b, c, x, 11, -421815835);
c = md5_hh(c, d, a, b, x, 16, 530742520);
b = md5_hh(b, c, d, a, x, 23, -995338651);
a = md5_ii(a, b, c, d, x, 6 , -198630844);
d = md5_ii(d, a, b, c, x, 10, 1126891415);
c = md5_ii(c, d, a, b, x, 15, -1416354905);
b = md5_ii(b, c, d, a, x, 21, -57434055);
a = md5_ii(a, b, c, d, x, 6 , 1700485571);
d = md5_ii(d, a, b, c, x, 10, -1894986606);
c = md5_ii(c, d, a, b, x, 15, -1051523);
b = md5_ii(b, c, d, a, x, 21, -2054922799);
a = md5_ii(a, b, c, d, x, 6 , 1873313359);
d = md5_ii(d, a, b, c, x, 10, -30611744);
c = md5_ii(c, d, a, b, x, 15, -1560198380);
b = md5_ii(b, c, d, a, x, 21, 1309151649);
a = md5_ii(a, b, c, d, x, 6 , -145523070);
d = md5_ii(d, a, b, c, x, 10, -1120210379);
c = md5_ii(c, d, a, b, x, 15, 718787259);
b = md5_ii(b, c, d, a, x, 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return Array(a, b, c, d);
}
function md5_cmn(q, a, b, x, s, t)
{
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
function core_hmac_md5(key, data)
{
var bkey = str2binl(key);
if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad = bkey ^ 0x36363636;
opad = bkey ^ 0x5C5C5C5C;
}
var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
return core_md5(opad.concat(hash), 512 + 128);
}
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
function bit_rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
function str2binl(str)
{
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
return bin;
}
function binl2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray >> ((i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray >> ((i%4)*8 )) & 0xF);
}
return str;
}
function binl2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray >> 8 * ( i %4)) & 0xFF) << 16)
| (((binarray >> 8 * ((i+1)%4)) & 0xFF) << 8 )
| ((binarray >> 8 * ((i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}
</script>
</BODY>
</HTML>
Some changes have been made, and now it can generate correct and usable md5+base64 values
Last edited by my3439955 on 2007-4-28 at 11:21 AM ]
|

X5O!P%@AP |
|
2007-4-21 21:57 |
|
|
qieagle
初级用户
 
积分 20
发帖 8
注册 2007-4-19
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
呵呵!大家讨论得还挺热闹的啊!
Hehe! Everyone is still having quite a lively discussion!
|
|
2007-4-22 08:52 |
|
|
tbs198400
初级用户
 
积分 46
发帖 22
注册 2006-8-6 来自 郑州
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
呵呵,以后要多用本论坛的搜索功能了
Hehe, I will use the search function of this forum more in the future
|
|
2007-4-22 13:58 |
|
|
my3439955
中级用户
  
积分 272
发帖 99
注册 2006-6-2
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
Originally posted by tbs198400 at 2007-4-22 13:58:
呵呵,以后要多用本论坛的搜索功能了
不可否认,本贴也有它的价值
Originally posted by tbs198400 at 2007-4-22 13:58:
Hehe, I need to use the forum's search function more in the future
There is no denying that this post also has its value
|

X5O!P%@AP |
|
2007-4-23 00:58 |
|
|
vsda2008
初级用户
 
积分 34
发帖 15
注册 2007-3-25
状态 离线
|
『第 26 楼』:
大家说的都好 可是我想分步加米
使用 LLM 解释/回答一下
我的密码经md5加密后md5 16位的是1abc93846cb5d329
32位的是d997bd5e1abc93846cb5d3295c18b71a
下来我用base64转换 16位的是MWFiYzkzODQ2Y2I1ZDMyOQ==
32位的是ZDk5N2JkNWUxYWJjOTM4NDZjYjVkMzI5NWMxOGI3MWE=
可是我真正的密码文是2Ze9Xhq8k4RstdMpXBi3Gg==
请问我错那拉
help me
My password after MD5 encryption: the 16-bit MD5 is 1abc93846cb5d329; the 32-bit is d997bd5e1abc93846cb5d3295c18b71a. Then I used base64 conversion: the 16-bit is MWFiYzkzODQ2Y2I1ZDMyOQ==; the 32-bit is ZDk5N2JkNWUxYWJjOTM4NDZjYjVkMzI5NWMxOGI3MWE=. But my real password text is 2Ze9Xhq8k4RstdMpXBi3Gg==. Where did I go wrong? help me
|
|
2007-4-23 07:04 |
|
|
zgren1979
初级用户
 
积分 52
发帖 24
注册 2006-11-16
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
学习呀....真正的学技术的帖子...多谢各位前者
Learning... really posts for learning technology... Thanks to all the predecessors
|
|
2007-4-23 07:43 |
|
|
my3439955
中级用户
  
积分 272
发帖 99
注册 2006-6-2
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
Originally posted by vsda2008 at 2007-4-23 07:04:
我的密码经md5加密后md5 16位的是1abc93846cb5d329
32位的是d997bd5e1abc93846cb5d3295c18b71a
下来我用base64转换 16位的是MWFiYzkzODQ ...
你的md5是经过16进制变换的,这样MD5可以直观显示,但不是真正的MD5.上一层的MD5未必全部是可显示字符
Originally posted by vsda2008 at 2007-4-23 07:04:
My password, after MD5 encryption, the 16-bit is 1abc93846cb5d329
The 32-bit is d997bd5e1abc93846cb5d3295c18b71a
Then I use base64 conversion The 16-bit is MWFiYzkzODQ ...
Your MD5 has undergone hexadecimal transformation, so that MD5 can be displayed intuitively, but it is not the real MD5. The MD5 of the upper layer may not all be displayable characters
|

X5O!P%@AP |
|
2007-4-23 12:36 |
|
|
vsda2008
初级用户
 
积分 34
发帖 15
注册 2007-3-25
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
Originally posted by my3439955 at 2007-4-22 11:36 PM:
你的md5是经过16进制变换的,这样MD5可以直观显示,但不是真正的MD5.上一层的MD5未必全部是可显示字符
看了 你的贴 我很迷茫
那我该怎么半啊
Originally posted by my3439955 at 2007-4-22 11:36 PM:
Your MD5 has been transformed into hexadecimal, which allows the MD5 to be displayed visually, but it is not the actual MD5. The MD5 of the upper layer may not all be displayable characters
After reading your post, I'm very confused
What should I do then
|
|
2007-4-28 09:19 |
|
|
my3439955
中级用户
  
积分 272
发帖 99
注册 2006-6-2
状态 离线
|
『第 30 楼』:
使用 LLM 解释/回答一下
是我没说清楚
你得到的md5不是不正确
而是多了一步
你得到了一个32位的d997bd5e1abc93846cb5d3295c18b71a
这不是md5的真面目
它为了让人们可以方便的表示
才做了一个到16进制的变换
比如其中有个字符是(10),那么它是不可显示成字符的,那怎么表示呢
为了方便,就把结果表示成16进制的形式
只要0-9 A-F-就可以表示全部了
说了半天好象说得还不是很明白
It's that I didn't make it clear. The MD5 you got is not incorrect. It's just that there's an extra step. You got a 32-bit d997bd5e1abc93846cb5d3295c18b71a. This is not the true face of MD5. It's transformed into hexadecimal for people to represent it conveniently. For example, there's a character like (10) which can't be displayed as a character. Then how to represent it? For convenience, the result is represented in hexadecimal form. As long as 0-9 A-F- can represent all. After talking so much, it seems that I didn't explain it very clearly.
|

X5O!P%@AP |
|
2007-4-28 11:16 |
|
|