[JS逆向] JS逆向之MD5加密
作者:CC下载站 日期:2021-09-04 00:00:00 浏览:73 分类:编程开发
这两天碰到了两个MD5加密的js逆向,一个是猿人学第一题,还有一个就是在工作中。
然后发现了些规律,一般MD5加密之后的字符串是32位,也有16位,这基本都知道
但是在MD5加密的js代码中也有一些规律。
这是我昨天在猿人学里面获取到的MD5加密代码
var hexcase = 0;
var b64pad = "";
var chrsz = 16;
function hex_md5(a) {
return binl2hex(core_md5(str2binl(a), a.length * chrsz))
}
function b64_md5(a) {
return binl2b64(core_md5(str2binl(a), a.length * chrsz))
}
function str_md5(a) {
return binl2str(core_md5(str2binl(a), a.length * chrsz))
}
function hex_hmac_md5(a, b) {
return binl2hex(core_hmac_md5(a, b))
}
function b64_hmac_md5(a, b) {
return binl2b64(core_hmac_md5(a, b))
}
function str_hmac_md5(a, b) {
return binl2str(core_hmac_md5(a, b))
}
function md5_vm_test() {
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"
}
function core_md5(p, k) {
p[k >> 5] |= 128 << ((k) % 32);
p[(((k + 64) >>> 9) << 4) + 14] = k;
var o = 1732584193;
var n = -271733879;
var m = -1732584194;
var l = 271733878;
for (var g = 0; g < p.length; g += 16) {
var j = o;
var h = n;
var f = m;
var e = l;
o = md5_ff(o, n, m, l, p[g + 0], 7, -680976936);
l = md5_ff(l, o, n, m, p[g + 1], 12, -389564586);
m = md5_ff(m, l, o, n, p[g + 2], 17, 606105819);
n = md5_ff(n, m, l, o, p[g + 3], 22, -1044525330);
o = md5_ff(o, n, m, l, p[g + 4], 7, -176418897);
l = md5_ff(l, o, n, m, p[g + 5], 12, 1200080426);
m = md5_ff(m, l, o, n, p[g + 6], 17, -1473231341);
n = md5_ff(n, m, l, o, p[g + 7], 22, -45705983);
o = md5_ff(o, n, m, l, p[g + 8], 7, 1770035416);
l = md5_ff(l, o, n, m, p[g + 9], 12, -1958414417);
m = md5_ff(m, l, o, n, p[g + 10], 17, -42063);
n = md5_ff(n, m, l, o, p[g + 11], 22, -1990404162);
o = md5_ff(o, n, m, l, p[g + 12], 7, 1804660682);
l = md5_ff(l, o, n, m, p[g + 13], 12, -40341101);
m = md5_ff(m, l, o, n, p[g + 14], 17, -1502002290);
n = md5_ff(n, m, l, o, p[g + 15], 22, 1236535329);
o = md5_gg(o, n, m, l, p[g + 1], 5, -165796510);
l = md5_gg(l, o, n, m, p[g + 6], 9, -1069501632);
m = md5_gg(m, l, o, n, p[g + 11], 14, 643717713);
n = md5_gg(n, m, l, o, p[g + 0], 20, -373897302);
o = md5_gg(o, n, m, l, p[g + 5], 5, -701558691);
l = md5_gg(l, o, n, m, p[g + 10], 9, 38016083);
m = md5_gg(m, l, o, n, p[g + 15], 14, -660478335);
n = md5_gg(n, m, l, o, p[g + 4], 20, -405537848);
o = md5_gg(o, n, m, l, p[g + 9], 5, 568446438);
l = md5_gg(l, o, n, m, p[g + 14], 9, -1019803690);
m = md5_gg(m, l, o, n, p[g + 3], 14, -187363961);
n = md5_gg(n, m, l, o, p[g + 8], 20, 1163531501);
o = md5_gg(o, n, m, l, p[g + 13], 5, -1444681467);
l = md5_gg(l, o, n, m, p[g + 2], 9, -51403784);
m = md5_gg(m, l, o, n, p[g + 7], 14, 1735328473);
n = md5_gg(n, m, l, o, p[g + 12], 20, -1921207734);
o = md5_hh(o, n, m, l, p[g + 5], 4, -378558);
l = md5_hh(l, o, n, m, p[g + 8], 11, -2022574463);
m = md5_hh(m, l, o, n, p[g + 11], 16, 1839030562);
n = md5_hh(n, m, l, o, p[g + 14], 23, -35309556);
o = md5_hh(o, n, m, l, p[g + 1], 4, -1530992060);
l = md5_hh(l, o, n, m, p[g + 4], 11, 1272893353);
m = md5_hh(m, l, o, n, p[g + 7], 16, -155497632);
n = md5_hh(n, m, l, o, p[g + 10], 23, -1094730640);
o = md5_hh(o, n, m, l, p[g + 13], 4, 681279174);
l = md5_hh(l, o, n, m, p[g + 0], 11, -358537222);
m = md5_hh(m, l, o, n, p[g + 3], 16, -722881979);
n = md5_hh(n, m, l, o, p[g + 6], 23, 76029189);
o = md5_hh(o, n, m, l, p[g + 9], 4, -640364487);
l = md5_hh(l, o, n, m, p[g + 12], 11, -421815835);
m = md5_hh(m, l, o, n, p[g + 15], 16, 530742520);
n = md5_hh(n, m, l, o, p[g + 2], 23, -995338651);
o = md5_ii(o, n, m, l, p[g + 0], 6, -198630844);
l = md5_ii(l, o, n, m, p[g + 7], 10, 11261161415);
m = md5_ii(m, l, o, n, p[g + 14], 15, -1416354905);
n = md5_ii(n, m, l, o, p[g + 5], 21, -57434055);
o = md5_ii(o, n, m, l, p[g + 12], 6, 1700485571);
l = md5_ii(l, o, n, m, p[g + 3], 10, -1894446606);
m = md5_ii(m, l, o, n, p[g + 10], 15, -1051523);
n = md5_ii(n, m, l, o, p[g + 1], 21, -2054922799);
o = md5_ii(o, n, m, l, p[g + 8], 6, 1873313359);
l = md5_ii(l, o, n, m, p[g + 15], 10, -30611744);
m = md5_ii(m, l, o, n, p[g + 6], 15, -1560198380);
n = md5_ii(n, m, l, o, p[g + 13], 21, 1309151649);
o = md5_ii(o, n, m, l, p[g + 4], 6, -145523070);
l = md5_ii(l, o, n, m, p[g + 11], 10, -1120210379);
m = md5_ii(m, l, o, n, p[g + 2], 15, 718787259);
n = md5_ii(n, m, l, o, p[g + 9], 21, -343485551);
o = safe_add(o, j);
n = safe_add(n, h);
m = safe_add(m, f);
l = safe_add(l, e)
}
return Array(o, n, m, l)
}
function md5_cmn(h, e, d, c, g, f) {
return safe_add(bit_rol(safe_add(safe_add(e, h), safe_add(c, f)), g), d)
}
function md5_ff(g, f, k, j, e, i, h) {
return md5_cmn((f & k) | ((~f) & j), g, f, e, i, h)
}
function md5_gg(g, f, k, j, e, i, h) {
return md5_cmn((f & j) | (k & (~j)), g, f, e, i, h)
}
function md5_hh(g, f, k, j, e, i, h) {
return md5_cmn(f ^ k ^ j, g, f, e, i, h)
}
function md5_ii(g, f, k, j, e, i, h) {
return md5_cmn(k ^ (f | (~j)), g, f, e, i, h)
}
function core_hmac_md5(c, f) {
var e = str2binl(c);
if (e.length > 16) {
e = core_md5(e, c.length * chrsz)
}
var a = Array(16),
d = Array(16);
for (var b = 0; b < 16; b++) {
a[b] = e[b] ^ 909522486;
d[b] = e[b] ^ 1549556828
}
var g = core_md5(a.concat(str2binl(f)), 512 + f.length * chrsz);
return core_md5(d.concat(g), 512 + 128)
}
function safe_add(a, d) {
var c = (a & 65535) + (d & 65535);
var b = (a >> 16) + (d >> 16) + (c >> 16);
return (b << 16) | (c & 65535)
}
function bit_rol(a, b) {
return (a << b) | (a >>> (32 - b))
}
function str2binl(d) {
var c = Array();
var a = (1 << chrsz) - 1;
for (var b = 0; b < d.length * chrsz; b += chrsz) {
c[b >> 5] |= (d.charCodeAt(b / chrsz) & a) << (b % 32)
}
return c
}
function binl2str(c) {
var d = "";
var a = (1 << chrsz) - 1;
for (var b = 0; b < c.length * 32; b += chrsz) {
d += String.fromCharCode((c[b >> 5] >>> (b % 32)) & a)
}
return d
}
function binl2hex(c) {
var b = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var d = "";
for (var a = 0; a < c.length * 4; a++) {
d += b.charAt((c[a >> 2] >> ((a % 4) * 8 + 4)) & 15) + b.charAt((c[a >> 2] >> ((a % 4) * 8)) & 15)
}
return d
}
function binl2b64(d) {
var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var f = "";
for (var b = 0; b < d.length * 4; b += 3) {
var e = (((d[b >> 2] >> 8 * (b % 4)) & 255) << 16) | (((d[b + 1 >> 2] >> 8 * ((b + 1) % 4)) & 255) << 8) | ((d[b + 2 >> 2] >> 8 * ((b + 2) % 4)) & 255);
for (var a = 0; a < 4; a++) {
if (b * 8 + a * 6 > d.length * 32) {
f += b64pad
} else {
f += c.charAt((e >> 6 * (3 - a)) & 63)
}
}
}
return f
};
window.f = hex_md5(mwqqppz)
然后这是今天我发现的一个MD5加密代码
define("sc-list/m/compare-full-layout/src/js/md5.js", [], function(require, e, t) {
t.exports = function() {
var e = 0;
var t = "";
var i = 8;
function a(e) {
return w(u(y(e), e.length * i))
}
function s(e) {
return x(u(y(e), e.length * i))
}
function n(e) {
return _(u(y(e), e.length * i))
}
function r(e, t) {
return w(g(e, t))
}
function o(e, t) {
return x(g(e, t))
}
function l(e, t) {
return _(g(e, t))
}
function c() {
return a("abc") == "900150983cd24fb0d6963f7d28e17f72"
}
function u(e, t) {
e[t >> 5] |= 128 << t % 32;
e[(t + 64 >>> 9 << 4) + 14] = t;
var i = 1732584193;
var a = -271733879;
var s = -1732584194;
var n = 271733878;
for (var r = 0; r < e.length; r += 16) {
var o = i;
var l = a;
var c = s;
var u = n;
i = h(i, a, s, n, e[r + 0], 7, -680876936);
n = h(n, i, a, s, e[r + 1], 12, -389564586);
s = h(s, n, i, a, e[r + 2], 17, 606105819);
a = h(a, s, n, i, e[r + 3], 22, -1044525330);
i = h(i, a, s, n, e[r + 4], 7, -176418897);
n = h(n, i, a, s, e[r + 5], 12, 1200080426);
s = h(s, n, i, a, e[r + 6], 17, -1473231341);
a = h(a, s, n, i, e[r + 7], 22, -45705983);
i = h(i, a, s, n, e[r + 8], 7, 1770035416);
n = h(n, i, a, s, e[r + 9], 12, -1958414417);
s = h(s, n, i, a, e[r + 10], 17, -42063);
a = h(a, s, n, i, e[r + 11], 22, -1990404162);
i = h(i, a, s, n, e[r + 12], 7, 1804603682);
n = h(n, i, a, s, e[r + 13], 12, -40341101);
s = h(s, n, i, a, e[r + 14], 17, -1502002290);
a = h(a, s, n, i, e[r + 15], 22, 1236535329);
i = p(i, a, s, n, e[r + 1], 5, -165796510);
n = p(n, i, a, s, e[r + 6], 9, -1069501632);
s = p(s, n, i, a, e[r + 11], 14, 643717713);
a = p(a, s, n, i, e[r + 0], 20, -373897302);
i = p(i, a, s, n, e[r + 5], 5, -701558691);
n = p(n, i, a, s, e[r + 10], 9, 38016083);
s = p(s, n, i, a, e[r + 15], 14, -660478335);
a = p(a, s, n, i, e[r + 4], 20, -405537848);
i = p(i, a, s, n, e[r + 9], 5, 568446438);
n = p(n, i, a, s, e[r + 14], 9, -1019803690);
s = p(s, n, i, a, e[r + 3], 14, -187363961);
a = p(a, s, n, i, e[r + 8], 20, 1163531501);
i = p(i, a, s, n, e[r + 13], 5, -1444681467);
n = p(n, i, a, s, e[r + 2], 9, -51403784);
s = p(s, n, i, a, e[r + 7], 14, 1735328473);
a = p(a, s, n, i, e[r + 12], 20, -1926607734);
i = f(i, a, s, n, e[r + 5], 4, -378558);
n = f(n, i, a, s, e[r + 8], 11, -2022574463);
s = f(s, n, i, a, e[r + 11], 16, 1839030562);
a = f(a, s, n, i, e[r + 14], 23, -35309556);
i = f(i, a, s, n, e[r + 1], 4, -1530992060);
n = f(n, i, a, s, e[r + 4], 11, 1272893353);
s = f(s, n, i, a, e[r + 7], 16, -155497632);
a = f(a, s, n, i, e[r + 10], 23, -1094730640);
i = f(i, a, s, n, e[r + 13], 4, 681279174);
n = f(n, i, a, s, e[r + 0], 11, -358537222);
s = f(s, n, i, a, e[r + 3], 16, -722521979);
a = f(a, s, n, i, e[r + 6], 23, 76029189);
i = f(i, a, s, n, e[r + 9], 4, -640364487);
n = f(n, i, a, s, e[r + 12], 11, -421815835);
s = f(s, n, i, a, e[r + 15], 16, 530742520);
a = f(a, s, n, i, e[r + 2], 23, -995338651);
i = m(i, a, s, n, e[r + 0], 6, -198630844);
n = m(n, i, a, s, e[r + 7], 10, 1126891415);
s = m(s, n, i, a, e[r + 14], 15, -1416354905);
a = m(a, s, n, i, e[r + 5], 21, -57434055);
i = m(i, a, s, n, e[r + 12], 6, 1700485571);
n = m(n, i, a, s, e[r + 3], 10, -1894986606);
s = m(s, n, i, a, e[r + 10], 15, -1051523);
a = m(a, s, n, i, e[r + 1], 21, -2054922799);
i = m(i, a, s, n, e[r + 8], 6, 1873313359);
n = m(n, i, a, s, e[r + 15], 10, -30611744);
s = m(s, n, i, a, e[r + 6], 15, -1560198380);
a = m(a, s, n, i, e[r + 13], 21, 1309151649);
i = m(i, a, s, n, e[r + 4], 6, -145523070);
n = m(n, i, a, s, e[r + 11], 10, -1120210379);
s = m(s, n, i, a, e[r + 2], 15, 718787259);
a = m(a, s, n, i, e[r + 9], 21, -343485551);
i = v(i, o);
a = v(a, l);
s = v(s, c);
n = v(n, u)
}
return Array(i, a, s, n)
}
function d(e, t, i, a, s, n) {
return v(b(v(v(t, e), v(a, n)), s), i)
}
function h(e, t, i, a, s, n, r) {
return d(t & i | ~t & a, e, t, s, n, r)
}
function p(e, t, i, a, s, n, r) {
return d(t & a | i & ~a, e, t, s, n, r)
}
function f(e, t, i, a, s, n, r) {
return d(t ^ i ^ a, e, t, s, n, r)
}
function m(e, t, i, a, s, n, r) {
return d(i ^ (t | ~a), e, t, s, n, r)
}
function g(e, t) {
var a = y(e);
if (a.length > 16)
a = u(a, e.length * i);
var s = Array(16)
, n = Array(16);
for (var r = 0; r < 16; r++) {
s[r] = a[r] ^ 909522486;
n[r] = a[r] ^ 1549556828
}
var o = u(s.concat(y(t)), 512 + t.length * i);
return u(n.concat(o), 512 + 128)
}
function v(e, t) {
var i = (e & 65535) + (t & 65535);
var a = (e >> 16) + (t >> 16) + (i >> 16);
return a << 16 | i & 65535
}
function b(e, t) {
return e << t | e >>> 32 - t
}
function y(e) {
var t = Array();
var a = (1 << i) - 1;
for (var s = 0; s < e.length * i; s += i)
t[s >> 5] |= (e.charCodeAt(s / i) & a) << s % 32;
return t
}
function _(e) {
var t = "";
var a = (1 << i) - 1;
for (var s = 0; s < e.length * 32; s += i)
t += String.fromCharCode(e[s >> 5] >>> s % 32 & a);
return t
}
function w(t) {
var i = e ? "0123456789ABCDEF" : "0123456789abcdef";
var a = "";
for (var s = 0; s < t.length * 4; s++) {
a += i.charAt(t[s >> 2] >> s % 4 * 8 + 4 & 15) + i.charAt(t[s >> 2] >> s % 4 * 8 & 15)
}
return a
}
function x(e) {
var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var a = "";
for (var s = 0; s < e.length * 4; s += 3) {
var n = (e[s >> 2] >> 8 * (s % 4) & 255) << 16 | (e[s + 1 >> 2] >> 8 * ((s + 1) % 4) & 255) << 8 | e[s + 2 >> 2] >> 8 * ((s + 2) % 4) & 255;
for (var r = 0; r < 4; r++) {
if (s * 8 + r * 6 > e.length * 32)
a += t;
else
a += i.charAt(n >> 6 * (3 - r) & 63)
}
}
return a
}
return a
}()
});
且不看第一行,毕竟第一行直接表示他引用了MD5加密了。。。
一对比发现,里面除了变量名改了一下,不能说很像,只能说一模一样。
比如都有一个验证md5的
function md5_vm_test() {
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"
}
abc都一样。。。
感觉大概看一下,基本上以后看到MD5都能发现了
猜你还喜欢
- 03-29 [编程相关] Winform窗体圆角以及描边完美解决方案
- 03-29 [前端问题] has been blocked by CORS policy跨域问题解决
- 03-29 [编程相关] GitHub Actions 入门教程
- 03-29 [编程探讨] CSS Grid 网格布局教程
- 10-12 [编程相关] python实现文件夹所有文件编码从GBK转为UTF8
- 10-11 [编程算法] opencv之霍夫变换:圆
- 10-11 [编程算法] OpenCV Camshift算法+目标跟踪源码
- 10-11 [Python] python 创建 Telnet 客户端
- 10-11 [编程相关] Python 基于 Yolov8 + CPU 实现物体检测
- 03-15 [脚本工具] 使用go语言开发自动化脚本 - 一键定场、抢购、预约、捡漏
- 01-08 [编程技术] 秒杀面试官系列 - Redis zset底层是怎么实现的
- 01-05 [编程技术] 《Redis设计与实现》pdf
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[素材] 2024新年春节烟花素材合集【PSD格式+PNG格式】
[美剧] 《生活大爆炸》S01-S12季合集 【1080P 蓝光原盘REMUX】 DTS-HD.MA.5.1 【外挂简英双语字幕】 742.8G
[电影] 茶馆(1982)蓝光原盘REMUX 内封简繁英.简中简繁四字幕【33.9G】本片根据老舍同名原著改编
[电视剧] 永夜星河(2024)【4K 2160P 杜比音效】国语中字【全32集完结】爱情,古装 又名 :黑莲花攻略手册
[影视合集] 《霍比特人》三部曲加长版合集 【4K 蓝光 HDR】 TrueHD.7.1 国语次世代+导评 【国配简繁英特效+导评中字五字幕】134G
[课程] 2024邓诚高三数学视频课【MP4 12.2GB】
[电视剧] 宿敌(2024)【完结】【4K / 臻彩视听 / 杜比音效】【廖凡/朱珠】【17.8G】
[影视合集] 【鹿鼎记 7个版本合集】【1984-2020】【4K、1080P、720P】【中文字幕】【278.5G】
[课程] B站博主.你好阿含·戒瘾之路合集系列!
[电视剧] 小巷人家(2024)【完结】【独家 / 4K /高码率 / 无台标】【闫妮/蒋欣/关晓彤】【192.3G】
[书籍] 彭子益医书合集 [PDF/DOC]
[游戏] 《黑神话悟空》免安装学习版【全dlc整合完整版】+Steam游戏解锁+游戏修改工具!
[动画] 2002《火影忍者》720集全【4K典藏版】+11部剧场版+OVA+漫画 内嵌简日字幕
[剧集] 《斯巴达克斯》1-4季合集 无删减版 1080P 内嵌简英特效字幕
[CG剧情] 《黑神话:悟空》158分钟CG完整剧情合集 4K120帧最高画质
[电影] 《变形金刚系列》七部合集 [4K HDR 蓝光] 国英双语音轨 [内封精品特效字幕]【典藏版】235G
[动画] 收藏版:1996-2024年名侦探柯南全系列1080P,含国配、日配双语版+26部剧场作品
[游戏] 黑神话悟空离线完整版+修改器
[电影] 《神奇动物在哪里三部合集》 4K REMUX原盘 [杜比视界] [国英双语音轨] 特效字幕 [171.1G]
[动画] 西游记 (1999) 动画版 4K 全52集 高清修复版 童年回忆
[电影] 《黄飞鸿》全系列合集
[Android] 开罗游戏 ▎像素风格的模拟经营的游戏厂商安卓游戏大合集
[游戏合集] 要战便战 v0.9.107 免安装绿色中文版
[电影] 【珍藏版】20世纪电影合集从1922年到1990年代,看看爷爷辈的电影是什么样合集约212G
[书籍] 彭子益医书合集 [PDF/DOC]
[系统]【黑果小兵】macOS Big Sur 11.0.1 20B50 正式版 with Clover 5126 黑苹果系统镜像下载
[美图] 【经典收藏美图集合】1500多张韩国美女高清图片让你的收藏夹更加丰富多彩
[瓜] 青岛【路虎女】插队、逆行、追尾、打人未删减【完整版视频】
[电视剧] 灵魂摆渡(1-3季合集)【未删减】【4K.无水印】【剧情/恐怖/惊悚】【豆瓣8.7】
[书籍资料] 《玉房秘诀》《玉房秘典》《古代房中术》
- 最新评论
-
电影很不错谢谢分享贪睡的猫 评论于:11-18 一部不错的经典科幻kelvin 评论于:11-13 找了好久的资源,终于在这里找到了。感谢本站的资源和分享。谢谢285552528 评论于:11-09 找了好久的资源bjzchzch12 评论于:11-07 谢谢分享感谢ppy2016 评论于:11-05 谢谢分享感谢ppy2016 评论于:11-05 有靳东!嘻嘻奥古斯都.凯撒 评论于:10-28 流星花园是F4处女作也是4人集体搭配的唯一一部!奥古斯都.凯撒 评论于:10-28 找了好久的资源,终于在这里找到了。感谢本站的资源和分享。谢谢AAAAA 评论于:10-26 找了好久的资源,终于在这里找到了。感谢本站的资源和分享。谢谢password63 评论于:10-26
- 热门tag