UNPKG

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