# ecdh-es

> Elliptic Curve Diffie-Hellman with ephemeral-static keys implementation for NodeJS

Latest version **0.0.8** (published 2015-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install ecdh-es
pnpm add ecdh-es
yarn add ecdh-es
bun add ecdh-es
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2015-01-11 |
| First published | 2014-12-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nadav Ivgi |
| Maintainers | nadav |
| Keywords | ecdsa, ecdh, ies, ecies |

## Links

- npm: https://www.npmjs.com/package/ecdh-es
- npm.io page: https://npm.io/package/ecdh-es

## Dependencies (4)

- [bigi](https://npm.io/package/bigi.md) ^1.4.0
- [ecurve](https://npm.io/package/ecurve.md) ^1.0.0
- [secure-random](https://npm.io/package/secure-random.md) ^1.1.1
- [crypto-browserify](https://npm.io/package/crypto-browserify.md) ^3.9.2

## Recent versions

- 0.0.8 (latest) — 2015-01-11
- 0.0.7 — 2015-01-11
- 0.0.5 — 2015-01-02
- 0.0.4 — 2014-12-31
- 0.0.3 — 2014-12-31

## README

# ecdh-es [![npm](https://img.shields.io/npm/v/ecdh-es.svg)](http://npmjs.org/package/ecdh-es) ![npm](https://img.shields.io/npm/l/ecdh-es.svg)

Elliptic Curve Diffie-Hellman with ephemeral-static keys implementation for NodeJS

### Install

    npm install --save ecdh-es

### Use
    var ecdh = require('ecdh-es')
      , pubkey = new Buffer('03a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd', 'hex')
      , privkey = new Buffer('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'hex')

    var encrypted = ecdh.encrypt(pubkey, 'Hello, world!') // -> Buffer
    var decrypted = ecdh.decrypt(privkey, encrypted) // -> Buffer
    // (use toString() to convert back to string message)

    // Uses the secp256k1 curve and AES-128-CBC cipher by default,
    // but can be overridden as follows:
    var ecdh = require('ecdh-es')({
      curve_name: 'secp192k1',
      cipher_algo: 'AES-256-CBC',
      key_size: 32,
      iv_size: 16
    })

### Browser usage
If you're using browserify to bundle your code, you can use this package
normally and everything should work the same.
Note, however, that
[crypto-browserify](https://github.com/dominictarr/crypto-browserify)
(which is used as a shim for nodejs's `crypto` api)
only support AES encryption.

If you're not using browserify, you can use the standalone bundle at `dist/ecdh.min.js`,
which comes packaged with all of the dependencies.
Including it in your page will provide global `ECDH` object you can use.

###  License

MIT

---
_Source: https://npm.io/package/ecdh-es · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
