S
S
Sergey Druzhko2021-05-28 00:06:18
JavaScript
Sergey Druzhko, 2021-05-28 00:06:18

Is it possible to adapt the code for GPU.JS?

There is such code in Node.JS. The CryptoJS library is used. Actually, you need to sort through 48k options, or maybe 5 times more, and on the processor it takes 0.6 seconds for one option. I went to the Internet, found GPU.JS, the site says that it seems to optimize JS for the GPU, but I've been trying for several hours now and nothing comes out, except perhaps an error on an error. I don’t really understand JS, so tell me, please, who knows, or is this library not for this at all and is intended for images?

var CryptoJS = require("crypto-js");



function hex2a(t) {
    for (var e = t.toString(), i = "", n = 0; n < e.length && "00" !== e.substr(n, 2); n += 2) i += String.fromCharCode(parseInt(e.substr(n, 2), 16));
    return i
}

function decodewallet(t, e) {
    for (var i = CryptoJS.SHA512(e), n = 0; n < 11512; n++) i = CryptoJS.SHA512(i);
    CryptoJS.algo.AES.keySize = 32, CryptoJS.algo.EvpKDF.cfg.iterations = 1e4, CryptoJS.algo.EvpKDF.cfg.keySize = 32;
    var r = CryptoJS.AES.decrypt(t, i.toString());
    return out = hex2a(r), out
}

let codes = ["TEsT1","TEsT2"];
var msg="U2FsdGVkX185RdQ4hP1hJTBpuz6pKjHyS+aY6XLFWAHlWyb8tC2UXUL91yeKkLoqDR3U6ky/Z9UzD2T6MAjDPCmHktslk/iJMp25zDIKYxwxi6yYMCJULRRUwiWqGNabMiH2lwk+m/gDV6KNZKlWgHkzH5Eqy+ZhdSbMOH29VDEeuGQTNOlXi5eUhC+/n0B90i1s/jBTGn8DKgpu9Di3FO9QQsXHzAk5GARNqM8fRSaVUR0LZjvcbeSCGTyxBwMfcEjl6aMq/CUxYpYdCq+1sbM/EJ6y6iaaKa88/6qm5h5utv7uv1PKmE3eK818w7pnDGs9tYlw2lo8BR24lsIytxPfWFkOZDg/sS17XbA0Nk8DxiCCZbKhhmI85H5CdPNxhf4rHCcd9kvdhG+Bhu5A0beEWAXt3ee8x3v4ZQ0+HrmR/lJWQDfBhKtau9GiljeHu2ruFiqHFVsQ8+edGiPtKa+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I7HicNYXGjC9X+lWfT8x/JxZvusJfeed/DjfDyIKinPQm71/3s5GVSihFBai7dtdx6pv7bh7BG9Rdo1XVjiTRjZrZwSHrpj07GUCr31WE0bf2x8nokJQCuIckvQ70FTLp8qQDMMCo0qXeAXE54yhDpkRQNOakF+Dk8Vm59B0sIpOoGskacJcvfNzTIgQ0kK91Cpy86BejuDYoZUQOplGdQTC1ippCuyFG+CtCi+O5X6gVeZiSUNYljvyfHupRlRDwKJqAj56Ba9vI+e0BxS3l1hcJDd5hISNnWAQo3ul5Z3Gu5k+ymviHX5+SUx/QN/oslkwmVRww3pme9QUkDnI15WVRecnyv1DcguypOAcRy2XpMgbRz77edYQnhzOoF1kdLTaUQ19/pTzrrmW65FokAGsnuByGO3oOQ2xWkZXVbLmanmXjOPf6a9WJDkiILZkfCMumAgRqWN767v7LBzQFBF5YoReZ+0XB5zmjS2mhnb5ucG1YdNeoOWQ+bZZbJTBwpqBdQrLJr3OZJzjQlTs/QkA==";
console.time("dbsave");
for(var i=0;i<2;i++){
  a=decodewallet(msg,codes[i]);
  if (a.search('"kty":"RSA"')>-1) {
    alert(codes[i]);
    console.log(codes[i]);
    break;
  }
}
console.log('DONE');
console.timeEnd("dbsave")

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question