Base58
Utility functions for working with Base58 values.
Examples
Below are some examples demonstrating common usages of the Base58
module:
Encoding to Base58
Values can be encoded to Base58 with:
import { Base58 } from 'ox'
const value_string = Base58.fromString('Hello World!')
'2NEpo7TZRRrLZSi2U' const value_bytes = Base58.fromBytes(new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]))
'2NEpo7TZRRrLZSi2U' const value_hex = Base58.fromHex('0x48656c6c6f20576f726c6421')
'2NEpo7TZRRrLZSi2U'
Decoding Base58
Values can be decoded from Base58 with:
import { Base58 } from 'ox'
const value_string = Base58.toString('2NEpo7TZRRrLZSi2U')
'Hello World!' const value_bytes = Base58.toBytes('2NEpo7TZRRrLZSi2U')
Uint8Array [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33] const value_hex = Base58.toHex('2NEpo7TZRRrLZSi2U')
'0x48656c6c6f20576f726c6421'
Functions
Name | Description |
---|---|
Base58.fromBytes | Encodes a Bytes.Bytes to a Base58-encoded string. |
Base58.fromHex | Encodes a Hex.Hex to a Base58-encoded string. |
Base58.fromString | Encodes a string to a Base58-encoded string. |
Base58.toBytes | Decodes a Base58-encoded string to a Bytes.Bytes . |
Base58.toHex | Decodes a Base58-encoded string to Hex.Hex . |
Base58.toString | Decodes a Base58-encoded string to a string. |