哪位大侠给个根据时间生成随机字母和数字自定义函数,谢谢~
RT,非常感激,谢谢啦~ 起码给个格式参考下嘛 就是生成随机字母串,或字符串加数字就行,根据系统时间。我也没思路。。。 你试一下,是不是这样子$time=@YEAR&@MON&@MDAY&@HOUR&@MIN
MsgBox(0,"","当前时间是:"&$time&@CRLF&"当前时间字符串:"&pc_au3_pswd($time))
Func pc_au3_pswd($char)
Local $code, $ascx
$code='var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";'&@CRLF
$code&='var base64DecodeChars = new Array('&@CRLF
$code&='-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,'&@CRLF
$code&='-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,'&@CRLF
$code&='-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,'&@CRLF
$code&='52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,'&@CRLF
$code&='-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,'&@CRLF
$code&='15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,'&@CRLF
$code&='-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,'&@CRLF
$code&='41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);'&@CRLF
$code&='function base64encode(str) {'&@CRLF
$code&='var out, i, len;'&@CRLF
$code&='var c1, c2, c3;'&@CRLF
$code&='len = str.length;'&@CRLF
$code&='i = 0;'&@CRLF
$code&='out = "";'&@CRLF
$code&='while(i < len) {'&@CRLF
$code&='c1 = str.charCodeAt(i++) & 0xff;'&@CRLF
$code&='if(i == len)'&@CRLF
$code&='{'&@CRLF
$code&='out += base64EncodeChars.charAt(c1 >> 2);'&@CRLF
$code&='out += base64EncodeChars.charAt((c1 & 0x3) << 4);'&@CRLF
$code&='out += "==";'&@CRLF
$code&='break;'&@CRLF
$code&='}'&@CRLF
$code&='c2 = str.charCodeAt(i++);'&@CRLF
$code&='if(i == len)'&@CRLF
$code&='{'&@CRLF
$code&='out += base64EncodeChars.charAt(c1 >> 2);'&@CRLF
$code&='out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));'&@CRLF
$code&='out += base64EncodeChars.charAt((c2 & 0xF) << 2);'&@CRLF
$code&='out += "=";'&@CRLF
$code&='break;'&@CRLF
$code&='}'&@CRLF
$code&='c3 = str.charCodeAt(i++);'&@CRLF
$code&='out += base64EncodeChars.charAt(c1 >> 2);'&@CRLF
$code&='out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));'&@CRLF
$code&='out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));'&@CRLF
$code&='out += base64EncodeChars.charAt(c3 & 0x3F);'&@CRLF
$code&='}'&@CRLF
$code&='return out;'&@CRLF
$code&='}'&@CRLF
$code&='function base64decode(str) {'&@CRLF
$code&='var c1, c2, c3, c4;'&@CRLF
$code&='var i, len, out;'&@CRLF
$code&='len = str.length;'&@CRLF
$code&='i = 0;'&@CRLF
$code&='out = "";'&@CRLF
$code&='while(i < len) {'&@CRLF
$code&='do {'&@CRLF
$code&='c1 = base64DecodeChars;'&@CRLF
$code&='} while(i < len && c1 == -1);'&@CRLF
$code&='if(c1 == -1)'&@CRLF
$code&='break;'&@CRLF
$code&='do {'&@CRLF
$code&='c2 = base64DecodeChars;'&@CRLF
$code&='} while(i < len && c2 == -1);'&@CRLF
$code&='if(c2 == -1)'&@CRLF
$code&='break;'&@CRLF
$code&='out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));'&@CRLF
$code&='do {'&@CRLF
$code&='c3 = str.charCodeAt(i++) & 0xff;'&@CRLF
$code&='if(c3 == 61)'&@CRLF
$code&='return out;'&@CRLF
$code&='c3 = base64DecodeChars;'&@CRLF
$code&='} while(i < len && c3 == -1);'&@CRLF
$code&='if(c3 == -1)'&@CRLF
$code&='break;'&@CRLF
$code&='out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));'&@CRLF
$code&='do {'&@CRLF
$code&='c4 = str.charCodeAt(i++) & 0xff;'&@CRLF
$code&='if(c4 == 61)'&@CRLF
$code&='return out;'&@CRLF
$code&='c4 = base64DecodeChars;'&@CRLF
$code&='} while(i < len && c4 == -1);'&@CRLF
$code&='if(c4 == -1)'&@CRLF
$code&='break;'&@CRLF
$code&='out += String.fromCharCode(((c3 & 0x03) << 6) | c4);'&@CRLF
$code&='}'&@CRLF
$code&='return out;'&@CRLF
$code&='}'&@CRLF
$code&='var hex_chr = "0123456789abcdef";'&@CRLF
$code&='function rhex(num)'&@CRLF
$code&='{'&@CRLF
$code&=' str = "";'&@CRLF
$code&=' for(j = 0; j <= 3; j++)'&@CRLF
$code&=' str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) +'&@CRLF
$code&=' hex_chr.charAt((num >> (j * 8)) & 0x0F);'&@CRLF
$code&=' return str;'&@CRLF
$code&='}'&@CRLF
$code&='function str2blks_MD5(str)'&@CRLF
$code&='{'&@CRLF
$code&=' nblk = ((str.length + 8) >> 6) + 1;'&@CRLF
$code&=' blks = new Array(nblk * 16);'&@CRLF
$code&=' for(i = 0; i < nblk * 16; i++) blks = 0;'&@CRLF
$code&=' for(i = 0; i < str.length; i++)'&@CRLF
$code&=' blks |= str.charCodeAt(i) << ((i % 4) * 8);'&@CRLF
$code&=' blks |= 0x80 << ((i % 4) * 8);'&@CRLF
$code&=' blks = str.length * 8;'&@CRLF
$code&=' return blks;'&@CRLF
$code&='}'&@CRLF
$code&='function add(x, y)'&@CRLF
$code&='{'&@CRLF
$code&=' var lsw = (x & 0xFFFF) + (y & 0xFFFF);'&@CRLF
$code&=' var msw = (x >> 16) + (y >> 16) + (lsw >> 16);'&@CRLF
$code&=' return (msw << 16) | (lsw & 0xFFFF);'&@CRLF
$code&='}'&@CRLF
$code&='function rol(num, cnt)'&@CRLF
$code&='{'&@CRLF
$code&=' return (num << cnt) | (num >>> (32 - cnt));'&@CRLF
$code&='}'&@CRLF
$code&='function cmn(q, a, b, x, s, t)'&@CRLF
$code&='{'&@CRLF
$code&=' return add(rol(add(add(a, q), add(x, t)), s), b);'&@CRLF
$code&='}'&@CRLF
$code&='function ff(a, b, c, d, x, s, t)'&@CRLF
$code&='{'&@CRLF
$code&=' return cmn((b & c) | ((~b) & d), a, b, x, s, t);'&@CRLF
$code&='}'&@CRLF
$code&='function gg(a, b, c, d, x, s, t)'&@CRLF
$code&='{'&@CRLF
$code&=' return cmn((b & d) | (c & (~d)), a, b, x, s, t);'&@CRLF
$code&='}'&@CRLF
$code&='function hh(a, b, c, d, x, s, t)'&@CRLF
$code&='{'&@CRLF
$code&=' return cmn(b ^ c ^ d, a, b, x, s, t);'&@CRLF
$code&='}'&@CRLF
$code&='function ii(a, b, c, d, x, s, t)'&@CRLF
$code&='{'&@CRLF
$code&=' return cmn(c ^ (b | (~d)), a, b, x, s, t);'&@CRLF
$code&='}'&@CRLF
$code&='function MD5(str)'&@CRLF
$code&='{'&@CRLF
$code&=' x = str2blks_MD5(str);'&@CRLF
$code&=' var a = 1732584193;'&@CRLF
$code&=' var b = -271733879;'&@CRLF
$code&=' var c = -1732584194;'&@CRLF
$code&=' var d = 271733878;'&@CRLF
$code&=' for(i = 0; i < x.length; i += 16)'&@CRLF
$code&=' {'&@CRLF
$code&=' var olda = a;'&@CRLF
$code&=' var oldb = b;'&@CRLF
$code&=' var oldc = c;'&@CRLF
$code&=' var oldd = d;'&@CRLF
$code&=' a = ff(a, b, c, d, x, 7 , -680876936);'&@CRLF
$code&=' d = ff(d, a, b, c, x, 12, -389564586);'&@CRLF
$code&=' c = ff(c, d, a, b, x, 17, 606105819);'&@CRLF
$code&=' b = ff(b, c, d, a, x, 22, -1044525330);'&@CRLF
$code&=' a = ff(a, b, c, d, x, 7 , -176418897);'&@CRLF
$code&=' d = ff(d, a, b, c, x, 12, 1200080426);'&@CRLF
$code&=' c = ff(c, d, a, b, x, 17, -1473231341);'&@CRLF
$code&=' b = ff(b, c, d, a, x, 22, -45705983);'&@CRLF
$code&=' a = ff(a, b, c, d, x, 7 , 1770035416);'&@CRLF
$code&=' d = ff(d, a, b, c, x, 12, -1958414417);'&@CRLF
$code&=' c = ff(c, d, a, b, x, 17, -42063);'&@CRLF
$code&=' b = ff(b, c, d, a, x, 22, -1990404162);'&@CRLF
$code&=' a = ff(a, b, c, d, x, 7 , 1804603682);'&@CRLF
$code&=' d = ff(d, a, b, c, x, 12, -40341101);'&@CRLF
$code&=' c = ff(c, d, a, b, x, 17, -1502002290);'&@CRLF
$code&=' b = ff(b, c, d, a, x, 22, 1236535329);'&@CRLF
$code&=' a = gg(a, b, c, d, x, 5 , -165796510);'&@CRLF
$code&=' d = gg(d, a, b, c, x, 9 , -1069501632);'&@CRLF
$code&=' c = gg(c, d, a, b, x, 14, 643717713);'&@CRLF
$code&=' b = gg(b, c, d, a, x, 20, -373897302);'&@CRLF
$code&=' a = gg(a, b, c, d, x, 5 , -701558691);'&@CRLF
$code&=' d = gg(d, a, b, c, x, 9 , 38016083);'&@CRLF
$code&=' c = gg(c, d, a, b, x, 14, -660478335);'&@CRLF
$code&=' b = gg(b, c, d, a, x, 20, -405537848);'&@CRLF
$code&=' a = gg(a, b, c, d, x, 5 , 568446438);'&@CRLF
$code&=' d = gg(d, a, b, c, x, 9 , -1019803690);'&@CRLF
$code&=' c = gg(c, d, a, b, x, 14, -187363961);'&@CRLF
$code&=' b = gg(b, c, d, a, x, 20, 1163531501);'&@CRLF
$code&=' a = gg(a, b, c, d, x, 5 , -1444681467);'&@CRLF
$code&=' d = gg(d, a, b, c, x, 9 , -51403784);'&@CRLF
$code&=' c = gg(c, d, a, b, x, 14, 1735328473);'&@CRLF
$code&=' b = gg(b, c, d, a, x, 20, -1926607734);'&@CRLF
$code&=' a = hh(a, b, c, d, x, 4 , -378558);'&@CRLF
$code&=' d = hh(d, a, b, c, x, 11, -2022574463);'&@CRLF
$code&=' c = hh(c, d, a, b, x, 16, 1839030562);'&@CRLF
$code&=' b = hh(b, c, d, a, x, 23, -35309556);'&@CRLF
$code&=' a = hh(a, b, c, d, x, 4 , -1530992060);'&@CRLF
$code&=' d = hh(d, a, b, c, x, 11, 1272893353);'&@CRLF
$code&=' c = hh(c, d, a, b, x, 16, -155497632);'&@CRLF
$code&=' b = hh(b, c, d, a, x, 23, -1094730640);'&@CRLF
$code&=' a = hh(a, b, c, d, x, 4 , 681279174);'&@CRLF
$code&=' d = hh(d, a, b, c, x, 11, -358537222);'&@CRLF
$code&=' c = hh(c, d, a, b, x, 16, -722521979);'&@CRLF
$code&=' b = hh(b, c, d, a, x, 23, 76029189);'&@CRLF
$code&=' a = hh(a, b, c, d, x, 4 , -640364487);'&@CRLF
$code&=' d = hh(d, a, b, c, x, 11, -421815835);'&@CRLF
$code&=' c = hh(c, d, a, b, x, 16, 530742520);'&@CRLF
$code&=' b = hh(b, c, d, a, x, 23, -995338651);'&@CRLF
$code&=' a = ii(a, b, c, d, x, 6 , -198630844);'&@CRLF
$code&=' d = ii(d, a, b, c, x, 10, 1126891415);'&@CRLF
$code&=' c = ii(c, d, a, b, x, 15, -1416354905);'&@CRLF
$code&=' b = ii(b, c, d, a, x, 21, -57434055);'&@CRLF
$code&=' a = ii(a, b, c, d, x, 6 , 1700485571);'&@CRLF
$code&=' d = ii(d, a, b, c, x, 10, -1894986606);'&@CRLF
$code&=' c = ii(c, d, a, b, x, 15, -1051523);'&@CRLF
$code&=' b = ii(b, c, d, a, x, 21, -2054922799);'&@CRLF
$code&=' a = ii(a, b, c, d, x, 6 , 1873313359);'&@CRLF
$code&=' d = ii(d, a, b, c, x, 10, -30611744);'&@CRLF
$code&=' c = ii(c, d, a, b, x, 15, -1560198380);'&@CRLF
$code&=' b = ii(b, c, d, a, x, 21, 1309151649);'&@CRLF
$code&=' a = ii(a, b, c, d, x, 6 , -145523070);'&@CRLF
$code&=' d = ii(d, a, b, c, x, 10, -1120210379);'&@CRLF
$code&=' c = ii(c, d, a, b, x, 15, 718787259);'&@CRLF
$code&=' b = ii(b, c, d, a, x, 21, -343485551);'&@CRLF
$code&=' a = add(a, olda);'&@CRLF
$code&=' b = add(b, oldb);'&@CRLF
$code&=' c = add(c, oldc);'&@CRLF
$code&=' d = add(d, oldd);'&@CRLF
$code&=' }'&@CRLF
$code&=' return rhex(b);'&@CRLF
$code&='}'&@CRLF
$code&='function pcpswd(str) {'&@CRLF
$code&='return base64encode(MD5(str));'&@CRLF
$code&='}'&@CRLF
$VBS = ObjCreate("ScriptControl")
$VBS.language = "JScript"
$VBS.addcode($code)
$ascx = $VBS.Run("pcpswd", $char)
Return $ascx
EndFunc 4楼辛苦了~ MD5? 如果要与时间关联,可以考虑直接把时间作为整数转换为N进制数
MsgBox(0, '', _62Hex(TimerInit(), 48))
Func _62Hex($iValue, $iHex)
If $iHex < 2 Or $iHex > 65 Then
Return SetError(1, 0, "")
EndIf
Local Const $KEY = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-+@"
Local $iMod, $sResult
While $iValue
$iMod = Mod($iValue, $iHex)
$sResult = StringMid($KEY, $iMod + 1, 1) & $sResult
$iValue = Int($iValue / $iHex)
WEnd
;Return StringFormat("(%d)%s", $iHex, $sResult)
Return $sResult
EndFunc ;==>_62Hex
这题目问的,有根据怎么叫随机,要无法还原吗,那就散列化
页:
[1]