ECPair/script_signature: switch to 64-byte RS buffers only
This commit is contained in:
parent
0d76f00917
commit
6c4977983d
7 changed files with 82 additions and 68 deletions
|
@ -2,22 +2,21 @@
|
|||
|
||||
var assert = require('assert')
|
||||
var bscriptSig = require('../src/script').signature
|
||||
var BigInteger = require('bigi')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var fixtures = require('./fixtures/signature.json')
|
||||
|
||||
describe('Script Signatures', function () {
|
||||
function fromRaw (signature) {
|
||||
return {
|
||||
r: new BigInteger(signature.r),
|
||||
s: new BigInteger(signature.s)
|
||||
}
|
||||
return Buffer.concat([
|
||||
Buffer.from(signature.r, 'hex'),
|
||||
Buffer.from(signature.s, 'hex')
|
||||
], 64)
|
||||
}
|
||||
|
||||
function toRaw (signature) {
|
||||
return {
|
||||
r: signature.r.toString(),
|
||||
s: signature.s.toString()
|
||||
r: signature.slice(0, 32).toString('hex'),
|
||||
s: signature.slice(32, 64).toString('hex')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue