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.
精彩评论