Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@relocke/base58

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@relocke/base58

A ultra light weight (566 byte) base58 encode / decode

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@ReLocke/base58

A ultra light weight stand alone JS implementation for base58 encoding & decoding.

  • zero dependencies 🙅
  • Only ~500 Bytes 🤏

size guaranteed with size-limit

npm version

support

setup

npm i --save @relocke/base58
esm import
import { base58_to_binary, binary_to_base58 } from '@relocke/base58'
import base58_to_binary from '@relocke/base58/base58_to_binary.js'
cjs require
const {
  base58_to_binary,
  binary_to_base58
} = require('@relocke/base58/base58_to_binary.js')
const base58_to_binary = require('@relocke/base58/base58_to_binary.js')

Reference

  1. IETF

API

Table of contents

namespace base58_chars

Base58 characters must ONLY include 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

Type: string


function base58_to_binary

converts a base58 to its corresponding binary representation Uint8Array

ParameterTypeDescription
base58Stringbase58_charsbase58 encoded string

Returns: Uint8Array — binary representation for the base58 string

Examples

base58 to binary

import { base58_to_binary } from '@relocke/base58'

const bin = base58_to_binary("6MRy")
console.log(bin) // Uint8Array(3) [15, 239, 64]
Buffer.from(bin).toString('hex') // 0fef40

function binary_to_base58

Converts a Uint8Array into a base58 string

ParameterTypeDescription
uint8arrayUint8Array | Arrayunsigned integer array

Returns: base58_chars — base58 string representation from the binary array

Examples

Binary array to base58 string

import { binary_to_base58 } from '@relocke/base58'

const str = binary_to_base58([15, 239, 64])
console.log(str) // 6MRy

Keywords

FAQs

Package last updated on 11 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc