Grab bag Google Translate, get TK=,TK algorithm

Source: Internet
Author: User

Made a small tool, integrated Google translation, but the translation of Chinese characters changed, TK value is also changing, for the Chinese character with the original TK will not, engaged a night, did not find the TK algorithm.

Later found that the wrong TK can also translate, do not know why, first make use of it.

JS code: Google Translate TK algorithm js code, call ZL ("kanji"), you can return to the available TK.

varWL =function (a) {returnfunction () {returnA}}, XL=function (A, b) { for(varc =0; C < b.length-2; c + =3) {            varD = B.charat (c +2), D= d >='a'? D.charcodeat (0) - the: Number (d), D= B.charat (c +1) =="+"? A >>> d:a <<D; A= B.charat (c) = ="+"? A + D &4294967295: a ^D}returnA}, ZL=function (a) { for(vare = [], F =0, G =0; G < a.length; g++) {                varm =A.charcodeat (g);  -> m? e[f++] = m: (2048> m? e[f++] = M >>6|192: (55296= = (M &64512) && G +1< A.length &&56320= = (A.charcodeat (g +1) &64512) ? (M =65536+ ((M &1023) <<Ten) + (A.charcodeat (++g) &1023), e[f++] = M >> -| -, e[f++] = M >> A& the| -): e[f++] = M >> A|224, e[f++] = M >>6& the| -), e[f++] = M & the| -)} a=0;  for(f =0; f < e.length; f++) A + = E[f], a = XL (A,"+-a^+6"); A= XL (A,"+-3^+b+-f"); 0> A && (a = (a) &2147483647) +2147483648); A= a%1000000; return(A.tostring () +"."+(a))};

Grab bag Google Translate, get TK=,TK algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.