We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The use of fromCharCode() is incorrect. It requires four 16-bit values (Unicode), not four 8-bit values (UTF-8).
The algorithms are not compact. For example, here is a more compact base64 encoder:
base64Encode = function(str) { if (typeof btoa != 'undefined') return btoa(str); // browser if (typeof Buffer != 'undefined') return new Buffer(str, 'binary').toString('base64'); // Node.js throw new Error('No Base64 Encode'); };
The text was updated successfully, but these errors were encountered:
I don't think the use of fromCharCode() is incorrect. Because btoa and atob function use 8-bit binary string, not 16-bit Unicode String.
btoa
atob
This version is compatible with IE6-IE9. If you are only used for IE10+ or other modern browsers, you can use https://github.com/xxtea/xxtea-html5. if you are used for Node.js, you can use https://github.com/xxtea/xxtea-nodejs.
Sorry, something went wrong.
No branches or pull requests
The use of fromCharCode() is incorrect. It requires four 16-bit values (Unicode), not four 8-bit values (UTF-8).
The algorithms are not compact. For example, here is a more compact base64 encoder:
base64Encode = function(str) {
if (typeof btoa != 'undefined') return btoa(str); // browser
if (typeof Buffer != 'undefined') return new Buffer(str, 'binary').toString('base64'); // Node.js
throw new Error('No Base64 Encode');
};
The text was updated successfully, but these errors were encountered: