1 | # bstring
|
2 |
|
3 | String encodings for javascript.
|
4 |
|
5 | ## Usage
|
6 |
|
7 | ``` js
|
8 | const {base58, bech32} = require('bstring');
|
9 |
|
10 | // Base58
|
11 | const b58 = base58.encode(Buffer.from([1,2,3]);
|
12 | assert(base58.test(b58));
|
13 | const data = base58.decode(b58);
|
14 | console.log(data);
|
15 |
|
16 | // Bech32
|
17 | const b32 = bech32.encode('bc', 0, Buffer.alloc(20, 0x10));
|
18 | assert(bech32.test(b32));
|
19 | const {hrp, version, hash} = bech32.decode(b32);
|
20 | console.log([hrp, version, hash]);
|
21 | ```
|
22 |
|
23 | ## Contribution and License Agreement
|
24 |
|
25 | If you contribute code to this project, you are implicitly allowing your code
|
26 | to be distributed under the MIT license. You are also implicitly verifying that
|
27 | all code is your original work. `</legalese>`
|
28 |
|
29 | ## License
|
30 |
|
31 | - Copyright (c) 2017, Christopher Jeffrey (MIT License).
|
32 |
|
33 | See LICENSE for more info.
|