bug fixes, credit to ibblondon and nxtchg. thanks

This commit is contained in:
OutCast3k 2016-02-25 23:09:43 +00:00
parent 695947b02d
commit 6970a07d60
2 changed files with 13 additions and 11 deletions

View file

@ -1,6 +1,6 @@
/*
Coinjs 0.01 beta by OutCast3k{at}gmail.com
A bitcoin frameworkcoinjs.
A bitcoin framework.
http://github.com/OutCast3k/coinjs or http://coinb.in/coinjs
*/
@ -620,7 +620,7 @@
} else if (coinjs.isArray(data)) {
r.buffer = data;
} else if (data instanceof coinjs.script) {
r.buffer = r.buffer;
r.buffer = data.buffer;
} else {
r.buffer = data;
}
@ -1042,12 +1042,10 @@
// hash is a byteArray of the message digest. so h1 == hash in our case
// Step: b
var v = new Uint8Array(32);
v = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
var v = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
// Step: c
var k = new Uint8Array(32);
k = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var k = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
// Step: d
k = Crypto.HMAC(Crypto.SHA256, v.concat([0]).concat(x).concat(hash), k, { asBytes: true });
@ -1120,9 +1118,13 @@
function scriptListSigs(scriptSig){
var r = {};
var c = 0;
if (scriptSig.chunks[0]==0 && scriptSig.chunks[scriptSig.chunks.length-1][scriptSig.chunks[scriptSig.chunks.length-1].length-1]==174){
for(var i=1;i<scriptSig.chunks.length-1;i++){
r[i] = scriptSig.chunks[i];
if (scriptSig.chunks[i] != 0){
c++;
r[c] = scriptSig.chunks[i];
}
}
}
return r;
@ -1433,7 +1435,7 @@
/* clone an object */
coinjs.clone = function(obj) {
if(obj == null || typeof(obj) != 'object') return obj;
var temp = obj.constructor();
var temp = new obj.constructor();
for(var key in obj) {
if(obj.hasOwnProperty(key)) {
@ -1460,7 +1462,7 @@
} else if (num < 4294967296) {
return [254].concat(coinjs.numToBytes(num,4));
} else {
return [253].concat(coinjs.numToBytes(num,8));
return [255].concat(coinjs.numToBytes(num,8));
}
}

View file

@ -1,8 +1,8 @@
---- Version 1.2 2016.02.09 ----
---- Version 1.2 2016.02.25 ----
77e4519962e2f6a9fc93342137dbb31c33b76b04 ./js/aes.js
3a09a8fc0cfe828b57fc798d668234d0490ee1a6 ./js/bootstrap-datetimepicker.min.js
253711c6d825de55a8360552573be950da180614 ./js/bootstrap.min.js
6e17437a7e5e0dd61ca450b4e69cca352fab4ee3 ./js/coin.js
87d677a724ee7186e5caf4e5169dc320bb380506 ./js/coin.js
16a0cf35c7dd8cdd3ec9fb06b7b120f674fe3b88 ./js/coinbin.js
988565bc2cb402d63ed5c5fd7ff47c4278efc2c5 ./js/collapse.js
9ba5ede3d7f9d4c8fd623395f196adfdcf7e970f ./js/crypto-min.js