magicHash now uses Buffers internally
This commit is contained in:
parent
dd049fc764
commit
1b46a10d2a
1 changed files with 6 additions and 6 deletions
|
@ -7,17 +7,17 @@ var ecdsa = require('./ecdsa')
|
||||||
var ECPubKey = require('./eckey').ECPubKey
|
var ECPubKey = require('./eckey').ECPubKey
|
||||||
|
|
||||||
// FIXME: magicHash is incompatible with other magic messages
|
// FIXME: magicHash is incompatible with other magic messages
|
||||||
var magicBytes = convert.stringToBytes('Bitcoin Signed Message:\n')
|
var magicBytes = new Buffer('Bitcoin Signed Message:\n')
|
||||||
|
|
||||||
function magicHash(message) {
|
function magicHash(message) {
|
||||||
var messageBytes = convert.stringToBytes(message)
|
var messageBytes = new Buffer(message)
|
||||||
|
|
||||||
var buffer = [].concat(
|
var buffer = Buffer.concat([
|
||||||
convert.numToVarInt(magicBytes.length),
|
new Buffer(convert.numToVarInt(magicBytes.length)),
|
||||||
magicBytes,
|
magicBytes,
|
||||||
convert.numToVarInt(messageBytes.length),
|
new Buffer(convert.numToVarInt(messageBytes.length)),
|
||||||
messageBytes
|
messageBytes
|
||||||
)
|
])
|
||||||
|
|
||||||
return crypto.hash256(buffer)
|
return crypto.hash256(buffer)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue