|
|
@ -5,7 +5,6 @@ var crypto = require('crypto') |
|
|
|
var convert = require('./convert') |
|
|
|
|
|
|
|
function hash160(buffer) { |
|
|
|
if (!Buffer.isBuffer(buffer)) buffer = new Buffer(buffer) // FIXME: transitionary
|
|
|
|
|
|
|
|
var step1 = sha256(buffer) |
|
|
|
|
|
|
@ -16,20 +15,14 @@ function hash160(buffer) { |
|
|
|
} |
|
|
|
|
|
|
|
function hash256(buffer) { |
|
|
|
if (!Buffer.isBuffer(buffer)) buffer = new Buffer(buffer) // FIXME: transitionary
|
|
|
|
|
|
|
|
return sha256(sha256(buffer)) |
|
|
|
} |
|
|
|
|
|
|
|
function sha1(buffer) { |
|
|
|
if (!Buffer.isBuffer(buffer)) buffer = new Buffer(buffer) // FIXME: transitionary
|
|
|
|
|
|
|
|
return crypto.createHash('sha1').update(buffer).digest() |
|
|
|
} |
|
|
|
|
|
|
|
function sha256(buffer) { |
|
|
|
if (!Buffer.isBuffer(buffer)) buffer = new Buffer(buffer) // FIXME: transitionary
|
|
|
|
|
|
|
|
return crypto.createHash('sha256').update(buffer).digest() |
|
|
|
} |
|
|
|
|
|
|
|