Replaced Crypto.util and util (was a typo) with conv

This commit is contained in:
vub 2013-10-08 05:42:28 -04:00
parent 38ea108183
commit f95b08a576
4 changed files with 9 additions and 8 deletions

View file

@ -3,6 +3,7 @@
var BigInteger = require('./jsbn/jsbn');
var Crypto = require('./crypto-js/crypto');
var conv = require('/convert');
var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
var base = BigInteger.valueOf(58);
@ -38,7 +39,7 @@ module.exports.encode = function (input) {
},
module.exports.encodeHex = function (input) {
return Crypto.util.bytesToHex(module.exports.encode(input));
return conv.bytesToHex(module.exports.encode(input));
}
// decode a base58 string into a byte array
@ -94,7 +95,7 @@ module.exports.checkEncode = function(input, vbyte) {
}
module.exports.checkEncodeHex = function (input, vbyte) {
return Crypto.util.bytesToHex(module.exports.encode(input));
return conv.bytesToHex(module.exports.encode(input));
}
module.exports.checkDecode = function(input) {

View file

@ -121,7 +121,7 @@ ECKey.prototype.toString = function (format) {
if (format === "base58") {
return base58.checkEncode(this.priv.toByteArrayUnsigned(),128);
} else {
return Crypto.util.bytesToHex(this.priv.toByteArrayUnsigned());
return conv.bytesToHex(this.priv.toByteArrayUnsigned());
}
};

View file

@ -384,7 +384,7 @@ Transaction.prototype.calcImpact = function (wallet) {
var valueOut = BigInteger.ZERO;
for (var j = 0; j < this.outs.length; j++) {
var txout = this.outs[j];
var hash = Crypto.util.bytesToHex(txout.script.simpleOutPubKeyHash());
var hash = conv.bytesToHex(txout.script.simpleOutPubKeyHash());
if (wallet.hasHash(hash)) {
valueOut = valueOut.add(util.valueToBigInt(txout.value));
}
@ -394,7 +394,7 @@ Transaction.prototype.calcImpact = function (wallet) {
var valueIn = BigInteger.ZERO;
for (var j = 0; j < this.ins.length; j++) {
var txin = this.ins[j];
var hash = Crypto.util.bytesToHex(txin.script.simpleInPubKeyHash());
var hash = conv.bytesToHex(txin.script.simpleInPubKeyHash());
if (wallet.hasHash(hash)) {
var fromTx = wallet.txIndex[txin.outpoint.hash];
if (fromTx) {
@ -450,7 +450,7 @@ Transaction.deserialize = function(buffer) {
for (var i = 0; i < ins; i++) {
obj.ins.push({
outpoint: {
hash: util.bytesToHex(readBytes(32)),
hash: conv.bytesToHex(readBytes(32)),
index: readAsInt(4)
},
script: new Script(readVarString()),

View file

@ -98,7 +98,7 @@ var Wallet = function () {
var pubs = [];
for (var i = 0; i < keys.length; i++) {
pubs.push(Crypto.util.bytesToHex(keys[i].getPub()));
pubs.push(conv.bytesToHex(keys[i].getPub()));
}
return pubs;
@ -329,7 +329,7 @@ Wallet.prototype.clearTransactions = function () {
* Check to see if a pubKeyHash belongs to this wallet.
*/
Wallet.prototype.hasHash = function (hash) {
if (Bitcoin.Util.isArray(hash)) hash = Crypto.util.bytesToHex(hash);
if (Bitcoin.Util.isArray(hash)) hash = conv.bytesToHex(hash);
// TODO: Just create an object with hashes as keys for faster lookup
for (var k = 0; k < this.addressHashes.length; k++) {