Hethers
  • Documentation
  • Getting Started
  • Application Programming Interface
    • Providers
      • Provider
        • Accounts Methods
        • Logs Methods
        • Network Status Methods
        • Transactions Methods
        • Event Emitter Methods
        • Base Provider
        • HederaProvider
      • Types
    • Contract Interaction
      • Contract
      • ContractFactory
      • Example: ERC-20 Contract
    • Utilities
      • Accounts
      • Addresses
      • Application Binary Interface
        • AbiCoder
        • ABI Formats
        • Fragments
        • Interface
      • BigNumber
      • Byte Manipulation
      • Constants
      • Display Logic and Input
      • Encoding Utilities
      • FixedNumber
      • Hashing Algorithms
      • HD Wallet
      • Logging
      • Property Utilities
      • Signing Key
      • Strings
      • Transactions
      • Web Utilities
      • Wordlists
    • Signers
  • Contributing
  • Other Resources
Powered by GitBook
On this page
  • Base58
  • Base64
  1. Application Programming Interface
  2. Utilities

Encoding Utilities

PreviousDisplay Logic and InputNextFixedNumber

Last updated 3 years ago

The Encoding Utilities - base58 and base64 are directly imported from . The complete documentation can be found in the official .

Base58

hethers.utils.base58.decode( textData ) ⇒ Uint8Array

Return a typed Uint8Array representation of textData decoded using base-58 encoding.

base58.decode("TzMhH");
// Uint8Array [ 18, 52, 86, 120 ]

hethers.utils.base58.encode( aBytesLike ) ⇒ string

Return aBytesLike encoded as a string using the base-58 encoding.

base58.encode("0x12345678");
// 'TzMhH'

base58.encode([ 0x12, 0x34, 0x56, 0x78 ]);
// 'TzMhH'

Base64

hethers.utils.base64.decode( textData ) ⇒ Uint8Array

Return a typed Uint8Array representation of textData decoded using base-64 encoding.

base64.decode("EjQ=");
// Uint8Array [ 18, 52 ]

hethers.utils.base64.encode( aBytesLike ) ⇒ string

Return aBytesLike encoded as a string using the base-64 encoding.

base64.encode("0x1234");
// 'EjQ='

base64.encode([ 0x12, 0x34 ]);
// 'EjQ='

The Ethers Project
ethers docs