Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-js-ecdsa

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-js-ecdsa - npm Package Compare versions

Comparing version 1.5.3 to 1.6.0

2

package.json
{
"name": "simple-js-ecdsa",
"version": "1.5.3",
"version": "1.6.0",
"description": "easy and light weight ecdsa implementation",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -54,3 +54,3 @@ # simple-js-ecdsa

```
const signature = identity.bip66Sign(<message>)
const signature = identity.signBip66(<message>)
```

@@ -57,0 +57,0 @@

@@ -100,6 +100,8 @@ const bigInt = require('big-integer')

bip66Sign(message, k = this.curve.modSet.random()) {
signBip66(message, k = this.curve.modSet.random()) {
let signature = this.sign(message, k)
const r = Buffer.from(signature.r, 'hex')
const s = Buffer.from(signature.s, 'hex')
const arrayR = bigInt(signature.r, 16).toArray(256).value
const arrayS = bigInt(signature.s, 16).toArray(256).value
const r = Buffer.from(arrayR)
const s = Buffer.from(arrayS)
const rl = r.length

@@ -116,7 +118,3 @@ const sl = s.length

s.copy(signature, rl + 6)
if (this.verifyBip66(message, signature)) {
return signature.toString('hex')
}
console.warn('⚠️ k value was unusable, making new k. this will be fixed in a later version')
return this.bip66Sign(message)
return this.signBip66(message)
}

@@ -123,0 +121,0 @@

@@ -63,3 +63,3 @@ try {

const signature = identity.sign('test', bigInt('2900c9abe4a9d00b2a4aa6663d8f4989c8cac35f4fe9b2c5b66e07a3903e1c3', 16))
const bip66Sig = identity.bip66Sign('test')
const bip66Sig = identity.signBip66('test')
if (signature.r.toString(16) !== '85a44b824bda975b15ac77a3256c5d6f21c19b0412eb19333844fc2dbd25dbba') {

@@ -95,3 +95,3 @@ throw 'invalid signature r value'

const signature = identity.sign(message)
const bip66Sig = identity.bip66Sign(message)
const bip66Sig = identity.signBip66(message)
if (identity.verify(message, signature) !== true) {

@@ -121,3 +121,3 @@ throw 'signing or verification failure'

const signature = identity.sign(message, bigInt('117684982898427616968903898096562672753697490468945332396836429490'))
const bip66Sig = identity.bip66Sign(message, bigInt('195824508170618319808973875696324677909297326707645576719203036558'))
const bip66Sig = identity.signBip66(message, bigInt('195824508170618319808973875696324677909297326707645576719203036558'))
if (signature.r != 'c71cd3057d59777e31d623c04ce69599a40b6daf345b787f46f863debe029755') {

@@ -124,0 +124,0 @@ throw 'signature is wrong'

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc