Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/web3pack/base-x
A modern base-x encoding library implemented in TypeScript with minimal dependencies for use in browser and Node.js.
https://github.com/web3pack/base-x
base16 base2 base45 base58 bitcoin crypto cryptography decode decoding encode encoding javascript nodejs npm typescript web3
Last synced: 9 days ago
JSON representation
A modern base-x encoding library implemented in TypeScript with minimal dependencies for use in browser and Node.js.
- Host: GitHub
- URL: https://github.com/web3pack/base-x
- Owner: Web3Pack
- License: mit
- Created: 2022-04-21T14:45:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T03:04:35.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T20:14:38.048Z (7 months ago)
- Topics: base16, base2, base45, base58, bitcoin, crypto, cryptography, decode, decoding, encode, encoding, javascript, nodejs, npm, typescript, web3
- Language: TypeScript
- Homepage:
- Size: 340 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![CodeQL](https://github.com/Web3Pack/base-x/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Web3Pack/base-x/actions/workflows/codeql-analysis.yml)
[![Node.js Package](https://github.com/Web3Pack/base-x/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/Web3Pack/base-x/actions/workflows/npm-publish.yml)# Base-x encoding library
A modern base-x encoding library implemented in TypeScript with minimal dependencies for use in browser and Node.js.
Following alphabets are supported:
- Base2 = 01
- Base16 = 0123456789abcdef
- Base45 = 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%\*+-./:
- Base58 = 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz## Example
```ts
import { base58 } from '@web3pack/base-x';const base58Converter = base58();
const text = Buffer.from('Hello World!');
const base58Text = base58Converter.encode(text);
// => 2NEpo7TZRRrLZSi2Uconst base58Decoded = base58Converter.decode(base58Text);
const base58DecodedText = Buffer.from(base58Decoded).toString();
// => Hello World!
```