You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP β†’
Socket
Book a DemoInstallSign in
Socket

@scure/base

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scure/base

Secure, audited & 0-dep implementation of base64, bech32, base58, base32 & base16

1.2.6
latest
Source
npmnpm
Version published
Weekly downloads
2.9M
-4.56%
Maintainers
1
Weekly downloads
Β 
Created

What is @scure/base?

@scure/base is a JavaScript library that provides utilities for encoding and decoding data in various formats such as Base64, Base58, and Base16. It is designed to be lightweight and efficient, making it suitable for use in both browser and Node.js environments.

What are @scure/base's main functionalities?

Base64 Encoding and Decoding

This feature allows you to encode and decode strings to and from Base64 format. It is useful for data serialization and transmission.

const { base64 } = require('@scure/base');

// Encoding a string to Base64
const encoded = base64.encode('Hello, World!');
console.log(encoded); // Outputs: 'SGVsbG8sIFdvcmxkIQ=='

// Decoding a Base64 string
const decoded = base64.decode(encoded);
console.log(decoded); // Outputs: 'Hello, World!'

Base58 Encoding and Decoding

This feature allows you to encode and decode strings to and from Base58 format. Base58 is commonly used in cryptocurrencies for encoding addresses and keys.

const { base58 } = require('@scure/base');

// Encoding a string to Base58
const encoded = base58.encode('Hello, World!');
console.log(encoded); // Outputs: '72k1xXWG59wUsYvG'

// Decoding a Base58 string
const decoded = base58.decode(encoded);
console.log(decoded); // Outputs: 'Hello, World!'

Base16 Encoding and Decoding

This feature allows you to encode and decode strings to and from Base16 (Hexadecimal) format. It is useful for representing binary data in a human-readable form.

const { base16 } = require('@scure/base');

// Encoding a string to Base16 (Hex)
const encoded = base16.encode('Hello, World!');
console.log(encoded); // Outputs: '48656c6c6f2c20576f726c6421'

// Decoding a Base16 (Hex) string
const decoded = base16.decode(encoded);
console.log(decoded); // Outputs: 'Hello, World!'

Other packages similar to @scure/base

Keywords

bech32

FAQs

Package last updated on 29 May 2025

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