Pads zeros in toBytes output, fixes #121
This commit is contained in:
parent
08da0b9a55
commit
1f0fb90213
1 changed files with 4 additions and 0 deletions
|
@ -85,6 +85,10 @@ ECKey.prototype.toHex = function() {
|
|||
|
||||
ECKey.prototype.toBytes = function() {
|
||||
var bytes = this.priv.toByteArrayUnsigned()
|
||||
|
||||
// ensure 32 bytes
|
||||
while (bytes.length < 32) bytes.unshift(0)
|
||||
|
||||
if (this.compressed) bytes.push(1)
|
||||
return bytes
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue