New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

base32-encoding

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base32-encoding

Encode / decode base32. Supports Buffers, strings, custom alphabets, abstract-encoding compliant

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-1.53%
Maintainers
1
Weekly downloads
 
Created
Source

base32-encoding

Encode / decode base32. Supports Buffers, strings, custom alphabets, abstract-encoding compliant

Usage

var base32 = require('base32-encoding')

var buf = crypto.randomBytes(32)

var b32 = base32.encode(buf)
var b256 = base32.decode(b32)

var str = base32.stringify(buf) // base32.encode then convert to string
var origBuf = base32.parse(str) // convert from string then base32.decode

API

var output = base32.encode(buf, [output], [offset])

Encode a normal Buffer as base32, meaning only the lower 5 bits are used. Takes ⌈len * 8 / 5⌉ bytes to encode. Takes optional Buffer output instead of allocating a new Buffer internally, and writes at optional offset. Returns output. Sets base32.encode.bytes to the number of bytes written.

var output = base32.decode(buf, [output], [offset])

Decode a base32 Buffer as a normal, "base256" Buffer, meaning only the lower 5 bits are read from buf and assembled into complete 8 bit bytes. Takes ⌊len * 5 / 8⌋ bytes to encode. Takes optional Buffer output instead of allocating a new Buffer internally, and writes at optional offset. Returns output. Sets base32.decode.bytes to the number of bytes written.

var len = base32.encodingLength(buf)

Returns ⌈len * 8 / 5⌉.

var str = base32.stringify(buf, [alphabet])

Encode buf to base32 and translate into a string using optional alphabet. alphabet defaults to 23456789abcdefghijkmnpqrstuvwxyz (missing o01l).

var buf = base32.parse(str, [alphabet])

Decode str from base32 and translate from a string using optional alphabet. alphabet defaults to 23456789abcdefghijkmnpqrstuvwxyz (missing o01l).

Install

npm install base32-encoding

License

ISC

Keywords

FAQs

Package last updated on 10 Feb 2018

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