mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-05-18 22:55:04 +00:00
Fix trailing whitespace
This commit is contained in:
@@ -8596,13 +8596,13 @@ module.exports={
|
|||||||
"OP_CHECKMULTISIGVERIFY": 175,
|
"OP_CHECKMULTISIGVERIFY": 175,
|
||||||
|
|
||||||
"OP_NOP1": 176,
|
"OP_NOP1": 176,
|
||||||
|
|
||||||
"OP_NOP2": 177,
|
"OP_NOP2": 177,
|
||||||
"OP_CHECKLOCKTIMEVERIFY": 177,
|
"OP_CHECKLOCKTIMEVERIFY": 177,
|
||||||
|
|
||||||
"OP_NOP3": 178,
|
"OP_NOP3": 178,
|
||||||
"OP_CHECKSEQUENCEVERIFY": 178,
|
"OP_CHECKSEQUENCEVERIFY": 178,
|
||||||
|
|
||||||
"OP_NOP4": 179,
|
"OP_NOP4": 179,
|
||||||
"OP_NOP5": 180,
|
"OP_NOP5": 180,
|
||||||
"OP_NOP6": 181,
|
"OP_NOP6": 181,
|
||||||
@@ -15165,4 +15165,4 @@ module.exports = {
|
|||||||
|
|
||||||
}).call(this,require("buffer").Buffer)
|
}).call(this,require("buffer").Buffer)
|
||||||
},{"bs58check":83,"buffer":5}]},{},[34])(34)
|
},{"bs58check":83,"buffer":5}]},{},[34])(34)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18123,7 +18123,7 @@ module.exports = function privateDecrypt(private_key, enc, reverse) {
|
|||||||
} else {
|
} else {
|
||||||
padding = 4;
|
padding = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = parseKeys(private_key);
|
var key = parseKeys(private_key);
|
||||||
var k = key.modulus.byteLength();
|
var k = key.modulus.byteLength();
|
||||||
if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) {
|
if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) {
|
||||||
@@ -22690,13 +22690,13 @@ Script.prototype.runInContext = function (context) {
|
|||||||
if (!(context instanceof Context)) {
|
if (!(context instanceof Context)) {
|
||||||
throw new TypeError("needs a 'context' argument.");
|
throw new TypeError("needs a 'context' argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var iframe = document.createElement('iframe');
|
var iframe = document.createElement('iframe');
|
||||||
if (!iframe.style) iframe.style = {};
|
if (!iframe.style) iframe.style = {};
|
||||||
iframe.style.display = 'none';
|
iframe.style.display = 'none';
|
||||||
|
|
||||||
document.body.appendChild(iframe);
|
document.body.appendChild(iframe);
|
||||||
|
|
||||||
var win = iframe.contentWindow;
|
var win = iframe.contentWindow;
|
||||||
var wEval = win.eval, wExecScript = win.execScript;
|
var wEval = win.eval, wExecScript = win.execScript;
|
||||||
|
|
||||||
@@ -22705,7 +22705,7 @@ Script.prototype.runInContext = function (context) {
|
|||||||
wExecScript.call(win, 'null');
|
wExecScript.call(win, 'null');
|
||||||
wEval = win.eval;
|
wEval = win.eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
forEach(Object_keys(context), function (key) {
|
forEach(Object_keys(context), function (key) {
|
||||||
win[key] = context[key];
|
win[key] = context[key];
|
||||||
});
|
});
|
||||||
@@ -22714,11 +22714,11 @@ Script.prototype.runInContext = function (context) {
|
|||||||
win[key] = context[key];
|
win[key] = context[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var winKeys = Object_keys(win);
|
var winKeys = Object_keys(win);
|
||||||
|
|
||||||
var res = wEval.call(win, this.code);
|
var res = wEval.call(win, this.code);
|
||||||
|
|
||||||
forEach(Object_keys(win), function (key) {
|
forEach(Object_keys(win), function (key) {
|
||||||
// Avoid copying circular objects like `top` and `window` by only
|
// Avoid copying circular objects like `top` and `window` by only
|
||||||
// updating existing context properties or new properties in the `win`
|
// updating existing context properties or new properties in the `win`
|
||||||
@@ -22733,9 +22733,9 @@ Script.prototype.runInContext = function (context) {
|
|||||||
defineProp(context, key, win[key]);
|
defineProp(context, key, win[key]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.removeChild(iframe);
|
document.body.removeChild(iframe);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -27914,4 +27914,4 @@ Sha512.prototype._hash = function () {
|
|||||||
module.exports = Sha512
|
module.exports = Sha512
|
||||||
|
|
||||||
},{"./hash":195,"inherits":189,"safe-buffer":193}]},{},[150])(150)
|
},{"./hash":195,"inherits":189,"safe-buffer":193}]},{},[150])(150)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,5 +6,4 @@ function convertCasinoCoinAdrr(address) {
|
|||||||
|
|
||||||
function convertCasinoCoinPriv(priv) {
|
function convertCasinoCoinPriv(priv) {
|
||||||
return window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
return window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21709,7 +21709,7 @@ module.exports = function privateDecrypt(private_key, enc, reverse) {
|
|||||||
} else {
|
} else {
|
||||||
padding = 4;
|
padding = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = parseKeys(private_key);
|
var key = parseKeys(private_key);
|
||||||
var k = key.modulus.byteLength();
|
var k = key.modulus.byteLength();
|
||||||
if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) {
|
if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) {
|
||||||
@@ -27194,13 +27194,13 @@ Script.prototype.runInContext = function (context) {
|
|||||||
if (!(context instanceof Context)) {
|
if (!(context instanceof Context)) {
|
||||||
throw new TypeError("needs a 'context' argument.");
|
throw new TypeError("needs a 'context' argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var iframe = document.createElement('iframe');
|
var iframe = document.createElement('iframe');
|
||||||
if (!iframe.style) iframe.style = {};
|
if (!iframe.style) iframe.style = {};
|
||||||
iframe.style.display = 'none';
|
iframe.style.display = 'none';
|
||||||
|
|
||||||
document.body.appendChild(iframe);
|
document.body.appendChild(iframe);
|
||||||
|
|
||||||
var win = iframe.contentWindow;
|
var win = iframe.contentWindow;
|
||||||
var wEval = win.eval, wExecScript = win.execScript;
|
var wEval = win.eval, wExecScript = win.execScript;
|
||||||
|
|
||||||
@@ -27209,7 +27209,7 @@ Script.prototype.runInContext = function (context) {
|
|||||||
wExecScript.call(win, 'null');
|
wExecScript.call(win, 'null');
|
||||||
wEval = win.eval;
|
wEval = win.eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
forEach(Object_keys(context), function (key) {
|
forEach(Object_keys(context), function (key) {
|
||||||
win[key] = context[key];
|
win[key] = context[key];
|
||||||
});
|
});
|
||||||
@@ -27218,11 +27218,11 @@ Script.prototype.runInContext = function (context) {
|
|||||||
win[key] = context[key];
|
win[key] = context[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var winKeys = Object_keys(win);
|
var winKeys = Object_keys(win);
|
||||||
|
|
||||||
var res = wEval.call(win, this.code);
|
var res = wEval.call(win, this.code);
|
||||||
|
|
||||||
forEach(Object_keys(win), function (key) {
|
forEach(Object_keys(win), function (key) {
|
||||||
// Avoid copying circular objects like `top` and `window` by only
|
// Avoid copying circular objects like `top` and `window` by only
|
||||||
// updating existing context properties or new properties in the `win`
|
// updating existing context properties or new properties in the `win`
|
||||||
@@ -27237,9 +27237,9 @@ Script.prototype.runInContext = function (context) {
|
|||||||
defineProp(context, key, win[key]);
|
defineProp(context, key, win[key]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.removeChild(iframe);
|
document.body.removeChild(iframe);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ function convertRippleAdrr(address) {
|
|||||||
|
|
||||||
function convertRipplePriv(priv) {
|
function convertRipplePriv(priv) {
|
||||||
return window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
return window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ bitcoinjs.bitcoin.networks.digibyte.p2wpkh = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bitcoinjs.bitcoin.networks.digibyte.p2wpkhInP2sh = {
|
bitcoinjs.bitcoin.networks.digibyte.p2wpkhInP2sh = {
|
||||||
baseNetwork: "digibyte",
|
baseNetwork: "digibyte",
|
||||||
messagePrefix: '\x19DigiByte Signed Message:\n',
|
messagePrefix: '\x19DigiByte Signed Message:\n',
|
||||||
bech32: 'dgb',
|
bech32: 'dgb',
|
||||||
bip32: {
|
bip32: {
|
||||||
@@ -199,7 +199,7 @@ bitcoinjs.bitcoin.networks.blockstamp.p2wpkh = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bitcoinjs.bitcoin.networks.blockstamp.p2wpkhInP2sh = {
|
bitcoinjs.bitcoin.networks.blockstamp.p2wpkhInP2sh = {
|
||||||
baseNetwork: "blockstamp",
|
baseNetwork: "blockstamp",
|
||||||
messagePrefix: '\x18BlockStamp Signed Message:\n',
|
messagePrefix: '\x18BlockStamp Signed Message:\n',
|
||||||
bech32: 'bc',
|
bech32: 'bc',
|
||||||
bip32: {
|
bip32: {
|
||||||
@@ -225,7 +225,7 @@ bitcoinjs.bitcoin.networks.nix.p2wpkh = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bitcoinjs.bitcoin.networks.nix.p2wpkhInP2sh = {
|
bitcoinjs.bitcoin.networks.nix.p2wpkhInP2sh = {
|
||||||
baseNetwork: "nix",
|
baseNetwork: "nix",
|
||||||
messagePrefix: '\x18Nix Signed Message:\n',
|
messagePrefix: '\x18Nix Signed Message:\n',
|
||||||
bech32: 'nix',
|
bech32: 'nix',
|
||||||
bip32: {
|
bip32: {
|
||||||
|
|||||||
+35
-35
@@ -26,13 +26,13 @@ var sjcl = {
|
|||||||
|
|
||||||
/** @namespace Key exchange functions. Right now only SRP is implemented. */
|
/** @namespace Key exchange functions. Right now only SRP is implemented. */
|
||||||
keyexchange: {},
|
keyexchange: {},
|
||||||
|
|
||||||
/** @namespace Block cipher modes of operation. */
|
/** @namespace Block cipher modes of operation. */
|
||||||
mode: {},
|
mode: {},
|
||||||
|
|
||||||
/** @namespace Miscellaneous. HMAC and PBKDF2. */
|
/** @namespace Miscellaneous. HMAC and PBKDF2. */
|
||||||
misc: {},
|
misc: {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @namespace Bit array encoders and decoders.
|
* @namespace Bit array encoders and decoders.
|
||||||
*
|
*
|
||||||
@@ -43,7 +43,7 @@ var sjcl = {
|
|||||||
* the method names are "fromBits" and "toBits".
|
* the method names are "fromBits" and "toBits".
|
||||||
*/
|
*/
|
||||||
codec: {},
|
codec: {},
|
||||||
|
|
||||||
/** @namespace Exceptions. */
|
/** @namespace Exceptions. */
|
||||||
exception: {
|
exception: {
|
||||||
/** @constructor Ciphertext is corrupt. */
|
/** @constructor Ciphertext is corrupt. */
|
||||||
@@ -51,13 +51,13 @@ var sjcl = {
|
|||||||
this.toString = function() { return "CORRUPT: "+this.message; };
|
this.toString = function() { return "CORRUPT: "+this.message; };
|
||||||
this.message = message;
|
this.message = message;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @constructor Invalid parameter. */
|
/** @constructor Invalid parameter. */
|
||||||
invalid: function(message) {
|
invalid: function(message) {
|
||||||
this.toString = function() { return "INVALID: "+this.message; };
|
this.toString = function() { return "INVALID: "+this.message; };
|
||||||
this.message = message;
|
this.message = message;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @constructor Bug or missing feature in SJCL. @constructor */
|
/** @constructor Bug or missing feature in SJCL. @constructor */
|
||||||
bug: function(message) {
|
bug: function(message) {
|
||||||
this.toString = function() { return "BUG: "+this.message; };
|
this.toString = function() { return "BUG: "+this.message; };
|
||||||
@@ -159,7 +159,7 @@ sjcl.bitArray = {
|
|||||||
if (a1.length === 0 || a2.length === 0) {
|
if (a1.length === 0 || a2.length === 0) {
|
||||||
return a1.concat(a2);
|
return a1.concat(a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
var last = a1[a1.length-1], shift = sjcl.bitArray.getPartial(last);
|
var last = a1[a1.length-1], shift = sjcl.bitArray.getPartial(last);
|
||||||
if (shift === 32) {
|
if (shift === 32) {
|
||||||
return a1.concat(a2);
|
return a1.concat(a2);
|
||||||
@@ -245,7 +245,7 @@ sjcl.bitArray = {
|
|||||||
_shiftRight: function (a, shift, carry, out) {
|
_shiftRight: function (a, shift, carry, out) {
|
||||||
var i, last2=0, shift2;
|
var i, last2=0, shift2;
|
||||||
if (out === undefined) { out = []; }
|
if (out === undefined) { out = []; }
|
||||||
|
|
||||||
for (; shift >= 32; shift -= 32) {
|
for (; shift >= 32; shift -= 32) {
|
||||||
out.push(carry);
|
out.push(carry);
|
||||||
carry = 0;
|
carry = 0;
|
||||||
@@ -253,7 +253,7 @@ sjcl.bitArray = {
|
|||||||
if (shift === 0) {
|
if (shift === 0) {
|
||||||
return out.concat(a);
|
return out.concat(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<a.length; i++) {
|
for (i=0; i<a.length; i++) {
|
||||||
out.push(carry | a[i]>>>shift);
|
out.push(carry | a[i]>>>shift);
|
||||||
carry = a[i] << (32-shift);
|
carry = a[i] << (32-shift);
|
||||||
@@ -263,7 +263,7 @@ sjcl.bitArray = {
|
|||||||
out.push(sjcl.bitArray.partial(shift+shift2 & 31, (shift + shift2 > 32) ? carry : out.pop(),1));
|
out.push(sjcl.bitArray.partial(shift+shift2 & 31, (shift + shift2 > 32) ? carry : out.pop(),1));
|
||||||
return out;
|
return out;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** xor a block of 4 words together.
|
/** xor a block of 4 words together.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -295,7 +295,7 @@ sjcl.bitArray = {
|
|||||||
* @author Mike Hamburg
|
* @author Mike Hamburg
|
||||||
* @author Dan Boneh
|
* @author Dan Boneh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @namespace UTF-8 strings */
|
/** @namespace UTF-8 strings */
|
||||||
sjcl.codec.utf8String = {
|
sjcl.codec.utf8String = {
|
||||||
/** Convert from a bitArray to a UTF-8 string. */
|
/** Convert from a bitArray to a UTF-8 string. */
|
||||||
@@ -310,7 +310,7 @@ sjcl.codec.utf8String = {
|
|||||||
}
|
}
|
||||||
return decodeURIComponent(escape(out));
|
return decodeURIComponent(escape(out));
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Convert from a UTF-8 string to a bitArray. */
|
/** Convert from a UTF-8 string to a bitArray. */
|
||||||
toBits: function (str) {
|
toBits: function (str) {
|
||||||
str = unescape(encodeURIComponent(str));
|
str = unescape(encodeURIComponent(str));
|
||||||
@@ -412,7 +412,7 @@ sjcl.hash.sha512.prototype = {
|
|||||||
* @constant
|
* @constant
|
||||||
*/
|
*/
|
||||||
blockSize: 1024,
|
blockSize: 1024,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the hash state.
|
* Reset the hash state.
|
||||||
* @return this
|
* @return this
|
||||||
@@ -423,7 +423,7 @@ sjcl.hash.sha512.prototype = {
|
|||||||
this._length = 0;
|
this._length = 0;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input several words to the hash.
|
* Input several words to the hash.
|
||||||
* @param {bitArray|String} data the data to hash.
|
* @param {bitArray|String} data the data to hash.
|
||||||
@@ -441,7 +441,7 @@ sjcl.hash.sha512.prototype = {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Complete hashing and output the hash value.
|
* Complete hashing and output the hash value.
|
||||||
* @return {bitArray} The hash value, an array of 16 big-endian words.
|
* @return {bitArray} The hash value, an array of 16 big-endian words.
|
||||||
@@ -736,12 +736,12 @@ sjcl.misc.hmac = function (key, Hash) {
|
|||||||
if (key.length > bs) {
|
if (key.length > bs) {
|
||||||
key = Hash.hash(key);
|
key = Hash.hash(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<bs; i++) {
|
for (i=0; i<bs; i++) {
|
||||||
exKey[0][i] = key[i]^0x36363636;
|
exKey[0][i] = key[i]^0x36363636;
|
||||||
exKey[1][i] = key[i]^0x5C5C5C5C;
|
exKey[1][i] = key[i]^0x5C5C5C5C;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._baseHash[0].update(exKey[0]);
|
this._baseHash[0].update(exKey[0]);
|
||||||
this._baseHash[1].update(exKey[1]);
|
this._baseHash[1].update(exKey[1]);
|
||||||
this._resultHash = new Hash(this._baseHash[0]);
|
this._resultHash = new Hash(this._baseHash[0]);
|
||||||
@@ -804,34 +804,34 @@ sjcl.misc.hmac.prototype.digest = function () {
|
|||||||
*/
|
*/
|
||||||
sjcl.misc.pbkdf2 = function (password, salt, count, length, Prff) {
|
sjcl.misc.pbkdf2 = function (password, salt, count, length, Prff) {
|
||||||
count = count || 1000;
|
count = count || 1000;
|
||||||
|
|
||||||
if (length < 0 || count < 0) {
|
if (length < 0 || count < 0) {
|
||||||
throw sjcl.exception.invalid("invalid params to pbkdf2");
|
throw sjcl.exception.invalid("invalid params to pbkdf2");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof password === "string") {
|
if (typeof password === "string") {
|
||||||
password = sjcl.codec.utf8String.toBits(password);
|
password = sjcl.codec.utf8String.toBits(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof salt === "string") {
|
if (typeof salt === "string") {
|
||||||
salt = sjcl.codec.utf8String.toBits(salt);
|
salt = sjcl.codec.utf8String.toBits(salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
Prff = Prff || sjcl.misc.hmac;
|
Prff = Prff || sjcl.misc.hmac;
|
||||||
|
|
||||||
var prf = new Prff(password),
|
var prf = new Prff(password),
|
||||||
u, ui, i, j, k, out = [], b = sjcl.bitArray;
|
u, ui, i, j, k, out = [], b = sjcl.bitArray;
|
||||||
|
|
||||||
for (k = 1; 32 * out.length < (length || 1); k++) {
|
for (k = 1; 32 * out.length < (length || 1); k++) {
|
||||||
u = ui = prf.encrypt(b.concat(salt,[k]));
|
u = ui = prf.encrypt(b.concat(salt,[k]));
|
||||||
|
|
||||||
for (i=1; i<count; i++) {
|
for (i=1; i<count; i++) {
|
||||||
ui = prf.encrypt(ui);
|
ui = prf.encrypt(ui);
|
||||||
for (j=0; j<ui.length; j++) {
|
for (j=0; j<ui.length; j++) {
|
||||||
u[j] ^= ui[j];
|
u[j] ^= ui[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out = out.concat(u);
|
out = out.concat(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ sjcl.hash.sha256.prototype = {
|
|||||||
* @constant
|
* @constant
|
||||||
*/
|
*/
|
||||||
blockSize: 512,
|
blockSize: 512,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the hash state.
|
* Reset the hash state.
|
||||||
* @return this
|
* @return this
|
||||||
@@ -901,7 +901,7 @@ sjcl.hash.sha256.prototype = {
|
|||||||
this._length = 0;
|
this._length = 0;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input several words to the hash.
|
* Input several words to the hash.
|
||||||
* @param {bitArray|String} data the data to hash.
|
* @param {bitArray|String} data the data to hash.
|
||||||
@@ -919,7 +919,7 @@ sjcl.hash.sha256.prototype = {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Complete hashing and output the hash value.
|
* Complete hashing and output the hash value.
|
||||||
* @return {bitArray} The hash value, an array of 8 big-endian words.
|
* @return {bitArray} The hash value, an array of 8 big-endian words.
|
||||||
@@ -929,12 +929,12 @@ sjcl.hash.sha256.prototype = {
|
|||||||
|
|
||||||
// Round out and push the buffer
|
// Round out and push the buffer
|
||||||
b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1,1)]);
|
b = sjcl.bitArray.concat(b, [sjcl.bitArray.partial(1,1)]);
|
||||||
|
|
||||||
// Round out the buffer to a multiple of 16 words, less the 2 length words.
|
// Round out the buffer to a multiple of 16 words, less the 2 length words.
|
||||||
for (i = b.length + 2; i & 15; i++) {
|
for (i = b.length + 2; i & 15; i++) {
|
||||||
b.push(0);
|
b.push(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// append the length
|
// append the length
|
||||||
b.push(Math.floor(this._length / 0x100000000));
|
b.push(Math.floor(this._length / 0x100000000));
|
||||||
b.push(this._length | 0);
|
b.push(this._length | 0);
|
||||||
@@ -955,7 +955,7 @@ sjcl.hash.sha256.prototype = {
|
|||||||
/*
|
/*
|
||||||
_init:[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],
|
_init:[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The SHA-256 hash key, to be precomputed.
|
* The SHA-256 hash key, to be precomputed.
|
||||||
* @private
|
* @private
|
||||||
@@ -990,7 +990,7 @@ sjcl.hash.sha256.prototype = {
|
|||||||
continue outer;
|
continue outer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i<8) {
|
if (i<8) {
|
||||||
this._init[i] = frac(Math.pow(prime, 1/2));
|
this._init[i] = frac(Math.pow(prime, 1/2));
|
||||||
}
|
}
|
||||||
@@ -998,13 +998,13 @@ sjcl.hash.sha256.prototype = {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform one cycle of SHA-256.
|
* Perform one cycle of SHA-256.
|
||||||
* @param {bitArray} words one block of words.
|
* @param {bitArray} words one block of words.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_block:function (words) {
|
_block:function (words) {
|
||||||
var i, tmp, a, b,
|
var i, tmp, a, b,
|
||||||
w = words.slice(0),
|
w = words.slice(0),
|
||||||
h = this._h,
|
h = this._h,
|
||||||
@@ -1032,13 +1032,13 @@ sjcl.hash.sha256.prototype = {
|
|||||||
} else {
|
} else {
|
||||||
a = w[(i+1 ) & 15];
|
a = w[(i+1 ) & 15];
|
||||||
b = w[(i+14) & 15];
|
b = w[(i+14) & 15];
|
||||||
tmp = w[i&15] = ((a>>>7 ^ a>>>18 ^ a>>>3 ^ a<<25 ^ a<<14) +
|
tmp = w[i&15] = ((a>>>7 ^ a>>>18 ^ a>>>3 ^ a<<25 ^ a<<14) +
|
||||||
(b>>>17 ^ b>>>19 ^ b>>>10 ^ b<<15 ^ b<<13) +
|
(b>>>17 ^ b>>>19 ^ b>>>10 ^ b<<15 ^ b<<13) +
|
||||||
w[i&15] + w[(i+9) & 15]) | 0;
|
w[i&15] + w[(i+9) & 15]) | 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = (tmp + h7 + (h4>>>6 ^ h4>>>11 ^ h4>>>25 ^ h4<<26 ^ h4<<21 ^ h4<<7) + (h6 ^ h4&(h5^h6)) + k[i]); // | 0;
|
tmp = (tmp + h7 + (h4>>>6 ^ h4>>>11 ^ h4>>>25 ^ h4<<26 ^ h4<<21 ^ h4<<7) + (h6 ^ h4&(h5^h6)) + k[i]); // | 0;
|
||||||
|
|
||||||
// shift register
|
// shift register
|
||||||
h7 = h6; h6 = h5; h5 = h4;
|
h7 = h6; h6 = h5; h5 = h4;
|
||||||
h4 = h3 + tmp | 0;
|
h4 = h3 + tmp | 0;
|
||||||
|
|||||||
@@ -13146,7 +13146,7 @@ Cursor.prototype.fill = function(value, length)
|
|||||||
{
|
{
|
||||||
length = this.buffer().length - this.tell();
|
length = this.buffer().length - this.tell();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.buffer().fill(value, this.tell(), this.tell() + length);
|
this.buffer().fill(value, this.tell(), this.tell() + length);
|
||||||
this.seek('+', length);
|
this.seek('+', length);
|
||||||
|
|
||||||
@@ -42404,13 +42404,13 @@ Script.prototype.runInContext = function (context) {
|
|||||||
if (!(context instanceof Context)) {
|
if (!(context instanceof Context)) {
|
||||||
throw new TypeError("needs a 'context' argument.");
|
throw new TypeError("needs a 'context' argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var iframe = document.createElement('iframe');
|
var iframe = document.createElement('iframe');
|
||||||
if (!iframe.style) iframe.style = {};
|
if (!iframe.style) iframe.style = {};
|
||||||
iframe.style.display = 'none';
|
iframe.style.display = 'none';
|
||||||
|
|
||||||
document.body.appendChild(iframe);
|
document.body.appendChild(iframe);
|
||||||
|
|
||||||
var win = iframe.contentWindow;
|
var win = iframe.contentWindow;
|
||||||
var wEval = win.eval, wExecScript = win.execScript;
|
var wEval = win.eval, wExecScript = win.execScript;
|
||||||
|
|
||||||
@@ -42419,7 +42419,7 @@ Script.prototype.runInContext = function (context) {
|
|||||||
wExecScript.call(win, 'null');
|
wExecScript.call(win, 'null');
|
||||||
wEval = win.eval;
|
wEval = win.eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
forEach(Object_keys(context), function (key) {
|
forEach(Object_keys(context), function (key) {
|
||||||
win[key] = context[key];
|
win[key] = context[key];
|
||||||
});
|
});
|
||||||
@@ -42428,11 +42428,11 @@ Script.prototype.runInContext = function (context) {
|
|||||||
win[key] = context[key];
|
win[key] = context[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var winKeys = Object_keys(win);
|
var winKeys = Object_keys(win);
|
||||||
|
|
||||||
var res = wEval.call(win, this.code);
|
var res = wEval.call(win, this.code);
|
||||||
|
|
||||||
forEach(Object_keys(win), function (key) {
|
forEach(Object_keys(win), function (key) {
|
||||||
// Avoid copying circular objects like `top` and `window` by only
|
// Avoid copying circular objects like `top` and `window` by only
|
||||||
// updating existing context properties or new properties in the `win`
|
// updating existing context properties or new properties in the `win`
|
||||||
@@ -42447,9 +42447,9 @@ Script.prototype.runInContext = function (context) {
|
|||||||
defineProp(context, key, win[key]);
|
defineProp(context, key, win[key]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.removeChild(iframe);
|
document.body.removeChild(iframe);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user