2
2
3
3
[ ![ npm version] [ 1 ]] [ 2 ] [ ![ Travis CI] [ 3 ]] [ 4 ] [ ![ license] [ 5 ]] [ 6 ] [ ![ Types] [ 7 ]] [ 8 ]
4
4
5
- This package contains all pure-js cryptographic primitives normally used when
5
+ All pure-js cryptographic primitives normally used when
6
6
developing Javascript / TypeScript applications and tools for Ethereum.
7
7
8
+ ** January 2022 update:** Version 1.0 of the package will be out soon. The module has been completely rewritten:
9
+
10
+ - ** 6x smaller:** 4,000 lines of code instead of 22,438 (with all deps); 185KB instead of 755KB
11
+ - 3 dependencies by one author instead of 38 by 5 authors
12
+ - [ Audited] ( #security ) by an independent security firm
13
+ - Check out the [ Upgrading] ( #upgrading ) section for breaking changes (there are almost none)
14
+
8
15
The cryptographic primitives included are:
9
16
10
17
* [ Hashes: SHA256, keccak-256, RIPEMD160, BLAKE2b] ( #hashes-sha256-keccak-256-ripemd160-blake2b )
@@ -15,20 +22,6 @@ The cryptographic primitives included are:
15
22
* [ BIP39 Mnemonic phrases] ( #bip39-mnemonic-phrases )
16
23
* [ AES Encryption] ( #aes-encryption )
17
24
18
- ** October 2021 update:** We're releasing ** experimental** version 0.2 of the package.
19
- The module has been completely rewritten:
20
-
21
- - ~ 6x smaller: 4,000 lines of code instead of 22,438 (with all deps); 185KB instead of 755KB
22
- - 3 dependencies (pending an audit) instead of 38
23
- - ** Same functionality** , all old APIs remain the same except for two breaking changes:
24
- 1 . We return ` Uint8Array ` from all methods that worked with ` Buffer ` before.
25
- ` Buffer ` has never been supported in browsers, while ` Uint8Array ` s are supported natively in both
26
- browsers and node.js. See [ Upgrading] ( #upgrading )
27
- 2 . We target runtimes with [ bigint] ( https://caniuse.com/bigint ) support,
28
- which is Chrome 67+, Edge 79+, Firefox 68+, Safari 14+, node.js 10+. If you need to support older runtimes, use
` [email protected] `
29
- 3 . If you've used ` secp256k1 ` , [ rename it to ` secp256k1-compat ` ] ( #legacy-secp256k1-compatibility-layer )
30
- - The new module [ has not been audited yet] ( #security ) , but it's in the process of getting the audit. Use it at your own risk
31
-
32
25
## Usage
33
26
34
27
Use NPM / Yarn in node.js / browser:
@@ -205,6 +198,9 @@ Note: if you've been using ethereum-cryptography v0.1, it had different API. We'
205
198
206
199
## BIP32 HD Keygen
207
200
201
+ Hierarchical deterministic (HD) wallets that conform to BIP32 standard.
202
+ Also available as standalone package [ micro-bip32] ( https://github.com/paulmillr/micro-bip32 ) .
203
+
208
204
This module exports a single class ` HDKey ` , which should be used like this:
209
205
210
206
``` ts
@@ -283,6 +279,8 @@ function mnemonicToSeedSync(mnemonic: string, passphrase: string = ""): Uint8Arr
283
279
The ` bip39 ` submodule provides functions to generate, validate and use seed
284
280
recovery phrases according to [ BIP39] ( https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki ) .
285
281
282
+ Also available as standalone package [ micro-bip39] ( https://github.com/paulmillr/micro-bip39 ) .
283
+
286
284
``` js
287
285
const { generateMnemonic } = require (" ethereum-cryptography/bip39" );
288
286
const { wordlist } = require (" ethereum-cryptography/bip39/wordlists/english" );
@@ -449,14 +447,16 @@ you found another primitive that is missing.
449
447
450
448
## Upgrading
451
449
452
- Version 0.2 changes from 0.1:
450
+ Version 1.0 changes from 0.1:
451
+
452
+ ** Same functionality** , all old APIs remain the same except for the breaking changes:
453
453
454
- - ** Breaking: ** we target runtimes with [ bigint ] ( https://caniuse.com/bigint ) support,
455
- which is Chrome 67+, Edge 79+, Firefox 68+, Safari 14+, node.js 10+. If you need to support
456
- older runtimes, use ` [email protected] `
457
- - ** Breaking: ** we return ` Uint8Array ` from all methods that worked with ` Buffer ` before.
458
- ` Buffer ` has never been supported in browsers, while ` Uint8Array ` s are supported natively in both
459
- browsers and node.js:
454
+ 1 . We return ` Uint8Array ` from all methods that worked with ` Buffer ` before.
455
+ ` Buffer ` has never been supported in browsers, while ` Uint8Array ` s are supported natively in both
456
+ browsers and node.js. See [ Upgrading ] ( #upgrading )
457
+ 2 . We target runtimes with [ bigint ] ( https://caniuse.com/bigint ) support,
458
+ which is Chrome 67+, Edge 79+, Firefox 68+, Safari 14+, node.js 10+. If you need to support older runtimes, use ` [email protected] `
459
+ 3 . If you've used ` secp256k1 ` , [ rename it to ` secp256k1-compat ` ] ( #legacy-secp256k1-compatibility-layer )
460
460
461
461
```
462
462
const { sha256 } = require("ethereum-cryptography/sha256");
@@ -475,7 +475,7 @@ const hashbo = hashb.toString("hex");
475
475
476
476
## Security
477
477
478
- This library is in the process of getting a security audit.
478
+ Audited by Cure53 on Jan 5, 2022. Check out the audit [ PDF ] ( ./audit/2022-01-05-cure53-audit-nbl2.pdf ) & [ URL ] ( https://cure53.de/pentest-report_hashing-libs.pdf ) .
479
479
480
480
## License
481
481
0 commit comments