|
5精币
- function RSAKey() {
- this.n = null;
- this.e = 0;
- this.d = null;
- this.p = null;
- this.q = null;
- this.dmp1 = null;
- this.dmq1 = null;
- this.coeff = null
- }
- function RSASetPublic(b, a) {
- if (b != null && a != null && b.length > 0 && a.length > 0) {
- this.n = parseBigInt(b, 16);
- this.e = parseInt(a, 16)
- } else {
- alert("Invalid RSA public key")
- }
- }
- function RSADoPublic(a) {
- return a.modPowInt(this.e, this.n)
- }
- function RSAEncrypt(f) {
- var a = pkcs1pad2(f, (this.n.bitLength() + 7) >> 3);
- if (a == null) {
- return null
- }
- var g = this.doPublic(a);
- if (g == null) {
- return null
- }
- var d = g.toString(16).toUpperCase();
- var e = 256 - d.length;
- for (var b = 0; b < e; b = b + 1) {
- d = "0" + d
- }
- return d
- }
- RSAKey.prototype.doPublic = RSADoPublic;
- RSAKey.prototype.setPublic = RSASetPublic;
- RSAKey.prototype.encrypt = RSAEncrypt;
- var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var b64pad = "=";
- function hex2b64(d) {
- var b;
- var e;
- var a = "";
- for (b = 0; b + 3 <= d.length; b += 3) {
- e = parseInt(d.substring(b, b + 3), 16);
- a += b64map.charAt(e >> 6) + b64map.charAt(e & 63)
- }
- if (b + 1 == d.length) {
- e = parseInt(d.substring(b, b + 1), 16);
- a += b64map.charAt(e << 2)
- } else {
- if (b + 2 == d.length) {
- e = parseInt(d.substring(b, b + 2), 16);
- a += b64map.charAt(e >> 2) + b64map.charAt((e & 3) << 4)
- }
- }
- while ((a.length & 3) > 0) {
- a += b64pad
- }
- return a
- }
- function b64tohex(e) {
- var c = "";
- var d;
- var a = 0;
- var b;
- for (d = 0; d < e.length; ++d) {
- if (e.charAt(d) == b64pad) {
- break
- }
- v = b64map.indexOf(e.charAt(d));
- if (v < 0) {
- continue
- }
- if (a == 0) {
- c += int2char(v >> 2);
- b = v & 3;
- a = 1
- } else {
- if (a == 1) {
- c += int2char((b << 2) | (v >> 4));
- b = v & 15;
- a = 2
- } else {
- if (a == 2) {
- c += int2char(b);
- c += int2char(v >> 2);
- b = v & 3;
- a = 3
- } else {
- c += int2char((b << 2) | (v >> 4));
- c += int2char(v & 15);
- a = 0
- }
- }
- }
- }
- if (a == 1) {
- c += int2char(b << 2)
- }
- return c
- }
- function b64toBA(e) {
- var d = b64tohex(e);
- var c;
- var b = new Array();
- for (c = 0; 2 * c < d.length; ++c) {
- b[c] = parseInt(d.substring(2 * c, 2 * c + 2), 16)
- }
- return b
- };
- function rsaPwd(c) {
- var b = new RSAKey();
- b.setPublic(toaPublicKey, "10001");
- var a = b.encrypt(c);
- return a
- };
复制代码 toaPublicKey是:BB955F6C6185B341C1A42EBF1FF9971B273878DBDAB252A0F1C305EBB529E116D807E0108BE6EDD47FF8DC5B6720FFE7F413CBB4ACDFB4C6BE609A5D60F5ADB261690A77755E058D4D9C0EC4FC2F5EB623DEBC88896003FBD8AFC4C3990828C66062A6D6CE509A2B0F8E06C4E332673FB86D235164B62B6110C1F1E0625B20ED
c应该是密码,a应该是加密结果,用脚本组件不行,我不太懂JS,哪位帮忙看一下,该怎么用啊
补充内容 (2014-8-15 17:45):
完整js代码在3楼
补充内容 (2014-8-15 17:51):
网站地址:https://passport.wanlitong.com/pass-info/oauth2/login.view?client_id=IN_000002&redirect_uri=http%3A%2F%2Fgame.wanlitong.com%2F%3Fact%3Dlogin%26st%3DloginCallback%26go_url%3DaHR0cDovL2dhbW...
补充内容 (2014-8-15 17:52):
上面的不行,这个吧http://game.wanlitong.com/?act=login&_time=1408093525015 |
最佳答案
查看完整内容
值是变动的。。 。
补充内容 (2014-8-15 18:18):
诶嘛 给精币。
|