|
刚上VIP工具看到一个会员朋友提到一个网站的JS登录加密算法! 随便就做了!函数如下:
网站地址:http://my.mtime.com/member/signi ... =201305021050158509- function $encodePassword(G) {
- if (G.length < 6) {
- return G;
- }
- var H = G.substr(0, 1);
- if (H == "*") {
- var E = parseInt(G.substr(G.length - 2, 2), 10);
- if (E == G.length) {
- return G;
- }
- }
- var F = _encode64(G);
- var E = F.length + 1 + 2;
- if (E < 10) {
- E = "0" + E;
- }
- return "*" + F + E;
- }
- function _encode64(R) {
- var O = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- var N = "";
- var U, P, T = "";
- var M, S, L, Q = "";
- var V = 0;
- do {
- U = R.charCodeAt(V++);
- P = R.charCodeAt(V++);
- T = R.charCodeAt(V++);
- M = U >> 2;
- S = ((U & 3) << 4) | (P >> 4);
- L = ((P & 15) << 2) | (T >> 6);
- Q = T & 63;
- if (isNaN(P)) {
- L = Q = 64;
- } else {
- if (isNaN(T)) {
- Q = 64;
- }
- }
- N = N + O.charAt(M) + O.charAt(S) + O.charAt(L) + O.charAt(Q);
- U = P = T = "";
- M = S = L = Q = "";
- } while ( V < R . length );
- return N;
- }
复制代码 实例: 密码 abb123456 加密出来是:*YWJiMTIzNDU215 可以自己去测试!
|
求助知识:请将问题描述清楚,最好把你有问题的源码打包上传上来,这样更方便大家帮助你。 友情提醒:本版被采纳的主题可在 申请荣誉值 帖子申请荣誉值,获得 3点 荣誉值,荣誉值可兑换荣誉会员、终身vip用户组。
|