add broken test for sha256ripe160
This commit is contained in:
parent
711ba6d9a8
commit
6af1b1dab6
2
Key.js
2
Key.js
|
@ -50,8 +50,6 @@ if (process.versions) {
|
||||||
};
|
};
|
||||||
|
|
||||||
kSpec.prototype.regenerateSync = function() {
|
kSpec.prototype.regenerateSync = function() {
|
||||||
|
|
||||||
console.log('[Key.js.53]', this); //TODO
|
|
||||||
if (!this.private) {
|
if (!this.private) {
|
||||||
throw new Error('Key does not have a private key set');
|
throw new Error('Key does not have a private key set');
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,7 @@ WalletKey.prototype.generate = function() {
|
||||||
|
|
||||||
WalletKey.prototype.storeObj = function() {
|
WalletKey.prototype.storeObj = function() {
|
||||||
var pubKey = this.privKey.public.toString('hex');
|
var pubKey = this.privKey.public.toString('hex');
|
||||||
console.log('[WalletKey.js.23:pubKey:]',pubKey); //TODO
|
|
||||||
var pubKeyHash = coinUtil.sha256ripe160(this.privKey.public);
|
var pubKeyHash = coinUtil.sha256ripe160(this.privKey.public);
|
||||||
console.log('[WalletKey.js.25:pubKeyHash:]', buffertools.toHex(pubKeyHash)); //TODO
|
|
||||||
var addr = new Address(this.network.addressPubkey, pubKeyHash);
|
var addr = new Address(this.network.addressPubkey, pubKeyHash);
|
||||||
var priv = new PrivateKey(this.network.keySecret, this.privKey.private, this.privKey.compressed);
|
var priv = new PrivateKey(this.network.keySecret, this.privKey.private, this.privKey.compressed);
|
||||||
var obj = {
|
var obj = {
|
||||||
|
|
|
@ -55,7 +55,19 @@
|
||||||
var p = new bitcore.PeerManager();
|
var p = new bitcore.PeerManager();
|
||||||
|
|
||||||
print('<hr>');
|
print('<hr>');
|
||||||
|
var coinUtil = bitcore.util;
|
||||||
|
|
||||||
|
var pk = '03d95e184cce34c3cfa58e9a277a09a7c5ed1b2a8134ea1e52887bc66fa3f47071'
|
||||||
|
|
||||||
|
var pubKeyHash = coinUtil.sha256(pk);
|
||||||
|
print(bitcore.buffertools.toHex(pubKeyHash));
|
||||||
|
pubKeyHash = coinUtil.sha256ripe160(pk);
|
||||||
|
print(bitcore.buffertools.toHex(pubKeyHash));
|
||||||
|
|
||||||
|
pubKeyHash = coinUtil.ripe160(new bitcore.Buffer('hola'));
|
||||||
|
print(bitcore.buffertools.toHex(pubKeyHash));
|
||||||
|
|
||||||
|
print('<hr>');
|
||||||
var WalletKey = bitcore.WalletKey;
|
var WalletKey = bitcore.WalletKey;
|
||||||
var networks = bitcore.networks;
|
var networks = bitcore.networks;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,23 @@ describe('util', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe('#sha256', function() {
|
||||||
|
var pk = '03d95e184cce34c3cfa58e9a277a09a7c5ed1b2a8134ea1e52887bc66fa3f47071'
|
||||||
|
it('should work for ' + pk, function() {
|
||||||
|
var pubKeyHash = coinUtil.sha256(pk);
|
||||||
|
var pkh = buffertools.toHex(pubKeyHash);
|
||||||
|
pkh.should.equal('a5c756101065ac5b8f689139e6d856fa99e54b5000b6428b43729d334cc9277d');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('#sha256ripe160', function() {
|
||||||
|
var pk = '03d95e184cce34c3cfa58e9a277a09a7c5ed1b2a8134ea1e52887bc66fa3f47071'
|
||||||
|
it('should work for ' + pk, function() {
|
||||||
|
var pubKeyHash = coinUtil.sha256ripe160(pk);
|
||||||
|
var pkh = buffertools.toHex(pubKeyHash);
|
||||||
|
pkh.should.equal('d166a41f27fd4b158f70314e5eee8998bf3d97d5');
|
||||||
|
});
|
||||||
|
});
|
||||||
describe('#ripemd160', function() {
|
describe('#ripemd160', function() {
|
||||||
var ripemdData = [
|
var ripemdData = [
|
||||||
['somemessage123', '12fd01a7ec6b9ba23b3a5c16fbfab3ac19624a88'],
|
['somemessage123', '12fd01a7ec6b9ba23b3a5c16fbfab3ac19624a88'],
|
||||||
|
|
Loading…
Reference in New Issue