Adds BI.toPaddedBuffer and toBuffer
This commit is contained in:
parent
596b31b1e1
commit
d8883e8d32
8 changed files with 131 additions and 26 deletions
src
|
@ -65,13 +65,7 @@ ECKey.prototype.sign = function(hash) {
|
|||
|
||||
// Export functions
|
||||
ECKey.prototype.toBuffer = function() {
|
||||
var buffer = new Buffer(this.D.toByteArrayUnsigned())
|
||||
|
||||
// pad out to atleast 32 bytes
|
||||
var padded = new Buffer(32 - buffer.length)
|
||||
padded.fill(0)
|
||||
|
||||
return Buffer.concat([padded, buffer])
|
||||
return this.D.toPaddedBuffer(32)
|
||||
}
|
||||
ECKey.prototype.toHex = function() {
|
||||
return this.toBuffer().toString('hex')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue