Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
token generating function changed
Browse files Browse the repository at this point in the history
  • Loading branch information
tx9191 committed May 12, 2016
1 parent 00f4802 commit ccd5643
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions providers/google-translate.js
Expand Up @@ -75,10 +75,9 @@ function translationResult(str, onError) {
// Some sort of token google uses
function generateToken(a) {
//at first sight seems to be a constant, but couldn't easily find how it was generated. May change.
//It is 0 for the official chrome extension, otherwise 402885
var b = 402885
var b = 406394
//text to utf8 codepoints
for (var c = "&tk=", d = [], e = 0, f = 0; f < a.length; f++) {
for (var d = [], e = 0, f = 0; f < a.length; f++) {
var g = a.charCodeAt(f);
0x80 > g ?
d[e++] = g
Expand All @@ -95,9 +94,10 @@ function generateToken(a) {
d[e++] = g >> 6 & 0x3f | 0x80)
, d[e++] = g & 0x3f | 0x80)
}
a = b || 0;
a = b;
for (e = 0; e < d.length; e++) a += d[e], a = tokenhelper(a, "+-a^+6");
a = tokenhelper(a, "+-3^+b+-f");
a ^= 2641390264;
0 > a && (a = (a & 2147483647) + 2147483648);
a %= 1E6;
return (a.toString() + "." + (a ^ b))
Expand Down

0 comments on commit ccd5643

Please sign in to comment.