Removed browser-native option (gave me a bad result)
This commit is contained in:
parent
65296f31f5
commit
3d3421ce17
2 changed files with 3 additions and 7 deletions
6
bitcoinjs-min.js
vendored
6
bitcoinjs-min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -20,8 +20,6 @@ module.exports.hexToBytes = function(hex) {
|
||||||
|
|
||||||
// Convert a byte array to a base-64 string
|
// Convert a byte array to a base-64 string
|
||||||
module.exports.bytesToBase64 = function(bytes) {
|
module.exports.bytesToBase64 = function(bytes) {
|
||||||
// Use browser-native function if it exists
|
|
||||||
if (typeof btoa == "function") return btoa(module.exports.bytesToString(bytes));
|
|
||||||
|
|
||||||
for(var base64 = [], i = 0; i < bytes.length; i += 3) {
|
for(var base64 = [], i = 0; i < bytes.length; i += 3) {
|
||||||
var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
|
var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
|
||||||
|
@ -38,8 +36,6 @@ module.exports.bytesToBase64 = function(bytes) {
|
||||||
|
|
||||||
// Convert a base-64 string to a byte array
|
// Convert a base-64 string to a byte array
|
||||||
module.exports.base64ToBytes = function(base64) {
|
module.exports.base64ToBytes = function(base64) {
|
||||||
// Use browser-native function if it exists
|
|
||||||
if (typeof atob == "function") return module.exports.stringToBytes(atob(base64));
|
|
||||||
|
|
||||||
// Remove non-base-64 characters
|
// Remove non-base-64 characters
|
||||||
base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
|
base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
|
||||||
|
|
Loading…
Reference in a new issue