# bip38-network

> BIP38 is a standard process to encrypt Bitcoin and crypto currency private keys that is impervious to brute force attacks thus protecting the user.

Latest version **3.0.0** (published 2019-02-17) · 0 weekly downloads

## Install

```sh
npm install bip38-network
pnpm add bip38-network
yarn add bip38-network
bun add bip38-network
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2019-02-17 |
| First published | 2019-02-14 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 15.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | JP Richardson |
| Maintainers | sondreb |
| Keywords | bitcoin, crypto, cryptography, litecoin |

## Links

- npm: https://www.npmjs.com/package/bip38-network
- Repository: https://github.com/sondreb/bip38
- Issues: https://github.com/sondreb/bip38/issues
- npm.io page: https://npm.io/package/bip38-network

## Dependencies (7)

- [bigi](https://npm.io/package/bigi.md) 1.4.2
- [ecurve](https://npm.io/package/ecurve.md) 1.0.6
- [bs58check](https://npm.io/package/bs58check.md) 2.1.2
- [buffer-xor](https://npm.io/package/buffer-xor.md) 2.0.2
- [create-hash](https://npm.io/package/create-hash.md) 1.2.0
- [scrypt-async](https://npm.io/package/scrypt-async.md) 2.0.1
- [browserify-aes](https://npm.io/package/browserify-aes.md) 1.2.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2019-02-17
- 2.0.2 — 2019-02-14

## README

# bip38-network

[![build status](https://secure.travis-ci.org/bitcoinjs/bip38.svg)](http://travis-ci.org/bitcoinjs/bip38)
[![Coverage Status](https://img.shields.io/coveralls/cryptocoinjs/bip38.svg)](https://coveralls.io/r/cryptocoinjs/bip38)
[![Version](http://img.shields.io/npm/v/bip38.svg)](https://www.npmjs.org/package/bip38)

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)

A JavaScript component that adheres to the [BIP38](https://github.com/bitcoin/bips/blob/master/bip-0038.mediawiki) standard to secure your crypto currency private keys. Fully compliant with Node.js and the browser (via Browserify).

**bip38-network** is a fork of the original **bip38**, with added support for alternative networks (bip38 only supports bitcoin main network) and relies on an async library for scrypt, making it more performant.

## Performance:

**Intel Core i7-8700K**
- bip38: ~8700ms
- bip38-network: ~430ms

## Why?
BIP38 is a standard process to encrypt Bitcoin and crypto currency private keys that is imprevious to brute force attacks thus protecting the user.

## Backwards compatibility

The 2.0.2 release that adds support for different networks, is available and is compatible with the existing bip38 package. While the latest (3+) version contains breaking changes and only supports async usage.

Installation (compatibility package):

```sh
npm install bip38-network@2.0.2
```

## Package Info
- homepage: [http://cryptocoinjs.com/modules/currency/bip38/](http://cryptocoinjs.com/modules/currency/bip38/)
- github: [https://github.com/cryptocoinjs/bip38](https://github.com/cryptocoinjs/bip38)
- tests: [https://github.com/cryptocoinjs/bip38/tree/master/test](https://github.com/cryptocoinjs/bip38/tree/master/test)
- issues: [https://github.com/cryptocoinjs/bip38/issues](https://github.com/cryptocoinjs/bip38/issues)
- license: **MIT**
- versioning: [http://semver-ftw.org](http://semver-ftw.org)


## Usage

### Installation

    npm install bip38-network


### API
### encrypt(buffer, compressed, passphrase[, progressCallback, scryptParams])

``` javascript
var bip38 = require('bip38-network')
var wif = require('wif')

var myWifString = '5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR'
var decoded = wif.decode(myWifString)

bip38.encryptAsync(decoded.privateKey, decoded.compressed, 'TestingOneTwoThree', (encryptedKey) => {
console.log(encryptedKey)
})

// => '6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg'
```


### decrypt(encryptedKey, passphrase[, progressCallback, scryptParams])

``` javascript
var bip38 = require('bip38')
var wif = require('wif')

var encryptedKey = '6PRVWUbkzzsbcVac2qwfssoUJAN1Xhrg6bNk8J7Nzm5H7kxEbn2Nh2ZoGg'
bip38.decryptAsync(encryptedKey, 'TestingOneTwoThree', function (decryptedKey) {
  console.log(decryptedKey)
})

console.log(wif.encode(0x80, decryptedKey.privateKey, decryptedKey.compressed))
// => '5KN7MzqK5wt2TP1fQCYyHBtDrXdJuXbUzm4A9rKAteGu3Qi5CVR'
```


# References
- https://github.com/bitcoin/bips/blob/master/bip-0038.mediawiki
- https://github.com/pointbiz/bitaddress.org/issues/56 (Safari 6.05 issue)
- https://github.com/casascius/Bitcoin-Address-Utility/tree/master/Model
- https://github.com/nomorecoin/python-bip38-testing/blob/master/bip38.py
- https://github.com/pointbiz/bitaddress.org/blob/master/src/ninja.key.js

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