前端密码传输加密,这是什么加密

键盘浪人 发布于 2016/08/16 19:23
阅读 1K+
收藏 2

是这样看到一个前端把用户名密码和验证码通过js加密传输到后台,请问这个是什么加密。怎么在后台解密。请教大牛们

var _16 = {
    _6: 8,
    _3: function(i, m, k, l, j, h, n) {
        return this._8(m & k | ~m & l, i, m, j, h, n)
    },
    _2: function(i, m, k, l, j, h, n) {
        return this._8(m & l | k & ~l, i, m, j, h, n)
    },
    _7: function(i, t) {
        i[t >> 5] |= 128 << t % 32;
        i[(t + 64 >>> 9 << 4) + 14] = t;
        for (var n = 1732584193,
        o = -271733879,
        j = -1732584194,
        v = 271733878,
        u = 0; u < i.length; u += 16) {
            var s = n,
            r = o,
            q = j,
            p = v,
            n = this._3(n, o, j, v, i[u + 0], 7, -680876936),
            v = this._3(v, n, o, j, i[u + 1], 12, -389564586),
            j = this._3(j, v, n, o, i[u + 2], 17, 606105819),
            o = this._3(o, j, v, n, i[u + 3], 22, -1044525330),
            n = this._3(n, o, j, v, i[u + 4], 7, -176418897),
            v = this._3(v, n, o, j, i[u + 5], 12, 1200080426),
            j = this._3(j, v, n, o, i[u + 6], 17, -1473231341),
            o = this._3(o, j, v, n, i[u + 7], 22, -45705983),
            n = this._3(n, o, j, v, i[u + 8], 7, 1770035416),
            v = this._3(v, n, o, j, i[u + 9], 12, -1958414417),
            j = this._3(j, v, n, o, i[u + 10], 17, -42063),
            o = this._3(o, j, v, n, i[u + 11], 22, -1990404162),
            n = this._3(n, o, j, v, i[u + 12], 7, 1804603682),
            v = this._3(v, n, o, j, i[u + 13], 12, -40341101),
            j = this._3(j, v, n, o, i[u + 14], 17, -1502002290),
            o = this._3(o, j, v, n, i[u + 15], 22, 1236535329),
            n = this._2(n, o, j, v, i[u + 1], 5, -165796510),
            v = this._2(v, n, o, j, i[u + 6], 9, -1069501632),
            j = this._2(j, v, n, o, i[u + 11], 14, 643717713),
            o = this._2(o, j, v, n, i[u + 0], 20, -373897302),
            n = this._2(n, o, j, v, i[u + 5], 5, -701558691),
            v = this._2(v, n, o, j, i[u + 10], 9, 38016083),
            j = this._2(j, v, n, o, i[u + 15], 14, -660478335),
            o = this._2(o, j, v, n, i[u + 4], 20, -405537848),
            n = this._2(n, o, j, v, i[u + 9], 5, 568446438),
            v = this._2(v, n, o, j, i[u + 14], 9, -1019803690),
            j = this._2(j, v, n, o, i[u + 3], 14, -187363961),
            o = this._2(o, j, v, n, i[u + 8], 20, 1163531501),
            n = this._2(n, o, j, v, i[u + 13], 5, -1444681467),
            v = this._2(v, n, o, j, i[u + 2], 9, -51403784),
            j = this._2(j, v, n, o, i[u + 7], 14, 1735328473),
            o = this._2(o, j, v, n, i[u + 12], 20, -1926607734),
            n = this._1(n, o, j, v, i[u + 5], 4, -378558),
            v = this._1(v, n, o, j, i[u + 8], 11, -2022574463),
            j = this._1(j, v, n, o, i[u + 11], 16, 1839030562),
            o = this._1(o, j, v, n, i[u + 14], 23, -35309556),
            n = this._1(n, o, j, v, i[u + 1], 4, -1530992060),
            v = this._1(v, n, o, j, i[u + 4], 11, 1272893353),
            j = this._1(j, v, n, o, i[u + 7], 16, -155497632),
            o = this._1(o, j, v, n, i[u + 10], 23, -1094730640),
            n = this._1(n, o, j, v, i[u + 13], 4, 681279174),
            v = this._1(v, n, o, j, i[u + 0], 11, -358537222),
            j = this._1(j, v, n, o, i[u + 3], 16, -722521979),
            o = this._1(o, j, v, n, i[u + 6], 23, 76029189),
            n = this._1(n, o, j, v, i[u + 9], 4, -640364487),
            v = this._1(v, n, o, j, i[u + 12], 11, -421815835),
            j = this._1(j, v, n, o, i[u + 15], 16, 530742520),
            o = this._1(o, j, v, n, i[u + 2], 23, -995338651),
            n = this._0(n, o, j, v, i[u + 0], 6, -198630844),
            v = this._0(v, n, o, j, i[u + 7], 10, 1126891415),
            j = this._0(j, v, n, o, i[u + 14], 15, -1416354905),
            o = this._0(o, j, v, n, i[u + 5], 21, -57434055),
            n = this._0(n, o, j, v, i[u + 12], 6, 1700485571),
            v = this._0(v, n, o, j, i[u + 3], 10, -1894986606),
            j = this._0(j, v, n, o, i[u + 10], 15, -1051523),
            o = this._0(o, j, v, n, i[u + 1], 21, -2054922799),
            n = this._0(n, o, j, v, i[u + 8], 6, 1873313359),
            v = this._0(v, n, o, j, i[u + 15], 10, -30611744),
            j = this._0(j, v, n, o, i[u + 6], 15, -1560198380),
            o = this._0(o, j, v, n, i[u + 13], 21, 1309151649),
            n = this._0(n, o, j, v, i[u + 4], 6, -145523070),
            v = this._0(v, n, o, j, i[u + 11], 10, -1120210379),
            j = this._0(j, v, n, o, i[u + 2], 15, 718787259),
            o = this._0(o, j, v, n, i[u + 9], 21, -343485551),
            n = this._4(n, s),
            o = this._4(o, r),
            j = this._4(j, q),
            v = this._4(v, p)
        }
        return [n, o, j, v]
    },
    _5: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),
    _13: function(i) {
        for (var m = [], k = i.length, l = 0; l < k; l++) {
            var j = i.charCodeAt(l);
            if (0 < j && 127 >= j) {
                m.push(i.charAt(l))
            } else {
                if (128 <= j && 2047 >= j) {
                    var h = 192 | j >> 6 & 31,
                    n = 128 | j & 63;
                    m.push(String.fromCharCode(h), String.fromCharCode(n))
                } else {
                    2048 <= j && 65535 >= j && (h = 224 | j >> 12 & 15, n = 128 | j >> 6 & 63, j = 128 | j & 63, m.push(String.fromCharCode(h), String.fromCharCode(n), String.fromCharCode(j)))
                }
            }
        }
        return m.join("")
    },
    _10: function(j, k) {
        if (!j) {
            return ""
        }
        j = this._13(j);
        for (var o = 0,
        m = j.length,
        n = []; o < m;) {
            var l = j.charCodeAt(o++) & ((1 << 8) - 1);
            n.push(this._5[l >> 2]);
            if (o == m) {
                n.push(this._5[(l & 3) << 4]);
                n.push(this._5[l & 47 | (1 << 5)]);
                break
            }
            o == (l >> 8 | 4) && n.push(this._5[(l & 15) << 2]);
            var i = j.charCodeAt(o++);
            if (o == m) {
                n.push(this._5[(i & 15) << 2]);
                n.push(this._5[(l & 3) << 4 | i >> 4 & 15]);
                n.push(this._5[i & 7 | 52]);
                break
            }
            var p = j.charCodeAt(o++);
            n.push(this._5[p & ((1 << 6) - 1)]);
            n.push(this._5[(i & 15) << 2 | (p & 192) >> 6]);
            n.push(this._5[(l & 3) << 4 | i >> 4 & 15]);
            o == m && n.push(this._5[(p & 15) | 8])
        }
        return ! k ? this._10(n.join(""), true) : n.join("")
    },
    _1: function(i, m, k, l, j, h, n) {
        return this._8(m ^ k ^ l, i, m, j, h, n)
    },
    _0: function(i, m, k, l, j, h, n) {
        return this._8(k ^ (m | ~l), i, m, j, h, n)
    },
    _14: function(f, k) {
        var i = this._9(f);
        16 < i.length && (i = this._7(i, f.length * this._6));
        for (var j = Array(16), h = Array(16), l = 0; 16 > l; l++) {
            j[l] = i[l] ^ 909522486,
            h[l] = i[l] ^ 1549556828
        }
        i = this._7(j.concat(this._9(k)), 512 + k.length * this._6);
        return this._7(h.concat(i), 640)
    },
    _4: function(e, c) {
        var a = (e & 65535) + (c & 65535);
        return (e >> 16) + (c >> 16) + (a >> 16) << 16 | a & 65535
    },
    _18: function(a) {
        return this._10(this._11(this._7(this._9(this._15(a)), (a.length + 8) * this._6)))
    },
    _17: function(b, a) {
        return this._10(this._11(this._14(b, a)))
    },
    _19: function(a) {
        return this._10(this._11(this._7(this._9(a), a.length * this._6)))
    },
    _11: function(e) {
        for (var c = "",
        a = 0; a < 4 * e.length; a++) {
            c += "0123456789abcdef".charAt(e[a >> 2] >> a % 4 * 8 + 8 & 15) + "0123456789abcdef".charAt(e[a >> 2] >> a % 4 * 8 + 4 & 15) + "0123456789abcdef".charAt(e[a >> 2] >> a % 4 * 8 & 15)
        }
        return c
    },
    _8: function(f, k, i, j, h, l) {
        return this._4(this._12(this._4(this._4(k, f), this._4(j, l)), h), i)
    },
    _12: function(b, a) {
        return b << a | b >>> 32 - a
    },
    _9: function(e) {
        for (var c = [], f = (1 << this._6) - 1, h = 0; h < e.length * this._6; h += this._6) {
            c[h >> 5] |= (e.charCodeAt(h / this._6) & f) << h % 32
        }
        return c
    },
    _15: function(e) {
        var c = new Date,
        f = c.getMonth() + 1,
        h = c.getDate();
        return e + c.getFullYear() + (10 > f ? "0": "") + f + (10 > h ? "0": "") + h
    }
};

如上是js加密功能代码,如下是调用部分:

$('#xxfu').val(window._16._10($('#txtUserName').val()));
$('#xxfp').val(window._16._10($('#txtUserPassword').val())); 
$('#xxfc').val(window._16._19($('#txtCheckCode').val().toLowerCase()));



加载中
1
某刀
某刀

看不懂+1。

另外,对于后台来说,只要传入的“密码”在按规则 Hash 后与数据库中的一致就算登录通过。从这个角度说,这个密码是否经过前端加密(或者说混淆)后台其实根本不关心。前端加密的过程对后端而言是完全透明的。

0
loyal
loyal
这是混淆后的js....这么看看不出来啥...
0
龙上
龙上
简单一点md5(密码+验证码),这样加密就可以了
0
0
键盘浪人
键盘浪人
上面长的代码,是功能方法,下面的是调用
0
键盘浪人
键盘浪人

1加密后是:ToFVI 

这到底是什么加密?


0
气质舞王尼古拉斯赵四
气质舞王尼古拉斯赵四
搜搜var n = 1732584193 整个常量 1732584193 会有发现哟,看起来是md5,也就是说传到后台没有解密(也没法解)估计是和存储的值md5后比较了
气质舞王尼古拉斯赵四
气质舞王尼古拉斯赵四
回复 @键盘浪人 : 貌似md5只是其中一部分
键盘浪人
键盘浪人
1加密后是:ToFVI ,md5,不在最短16位,最长32位的吗
0
飞炀
飞炀

应该只是MD5散列运算了一下,并不需要后台解密,后台根据同样的规则进行一次散列运算比对结果就行了。这样是为了避免TCP/IP抓包导致密码明文泄露问题。

根据评论仔细看了一下,应该是修改过的BASE64加密,单次加密结果和BASE64很像,只是没有结尾的=,替换成了别的字符,并且递归调用了两次加密。

飞炀
飞炀
回复 @键盘浪人 : 喔,仔细看了一下,并没有调用MD5的散列,这个方法只调用了一种变形了的BASE64运算,结果跟BASE64很像又好像把结尾的=换成了别的字符,并且运算了两次出现的结果。
键盘浪人
键盘浪人
1加密后是:ToFVI ,md5,不在最短16位,最长32位的吗
0
iehyou
iehyou

应该是改过的base64、、、、

看到“ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/” 就是base64的预兆。

返回顶部
顶部