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

ecdsa

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecdsa

Elliptical Curve Cryptography Digital Signing

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

ecdsa

JavaScript component to Elliptical Curve Cryptography signing and verify.

See this article for more details: bitcoin address.

Install

Node.js/Browserify

npm install --save ecdsa

Component

component install cryptocoinjs/ecdsa

Bower

bower install ecdsa

Script

<script src="/path/to/ecdsa.js"></script>

Example

var ecdsa = require('../lib/ecdsa')
  , sha256 = require('sha256')
  , secureRandom = require('secure-random')
  , ecparams = require('ecurve-names')('secp256k1')
  , BigInteger = require('cryptocoin-bigint')

var randArr = secureRandom(32, {array: true})
var privKey = BigInteger.fromByteArrayUnsigned(randArr)
//var privKey = ecdsa.getBigRandom(ecparams.getN())
var pubPoint = ecparams.getG().multiply(privKey)
var pubKey = pubPoint.getEncoded(false) //true => compressed, fails though, must investigate
var msg = "hello world!"
var shaMsg = sha256(msg)
var signature = ecdsa.sign(shaMsg, privKey)
var isValid = ecdsa.verify(shaMsg, signature, pubKey)
console.log(isValid) //true

Credits

It's not clear to me if this is based upon Tom Wu's work or Stefen Thomas.

Keywords

FAQs

Package last updated on 07 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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