开发者

Javascript Base64 decode using a reverse loop?

According to this: http://jsperf.com/fors-vs-while/15 running loops in reverse in javascript yield much f开发者_如何转开发aster results. Has anyone heard of or tried decoding Base64 strings using javascript in reverse?


The algorithm would be something like :

   1. Pad the input string to a multiple of 3 characters
   2. Initialize an empty results array 
   3. Looping backwards in the input string taking 3 chars at a time
   4.    convert 3 chars to the 4 Base64 equivalent
   5.    unshift the Base64 string to the results array
   6. Return the join of the results array.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜