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

@scure/base

Package Overview
Dependencies
Maintainers
1
Versions
14
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.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by12.65%
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

FAQs

Package last updated on 22 Nov 2024

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