Skip to content

rmhaiderali/base45

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

base45

Forked from irony/base45 and modified to be web compatible.

base45 is a base45 encoder/decoder that is fully compatible draft-faltstrom-base45-02.

Node.js Package

Introduction

When using QR or Aztec codes a different encoding scheme is needed than the already established base 64, base 32 and base 16 encoding

Installation

Via npm:

npm install @rmhaiderali/base45
import base45 from "@rmhaiderali/base45"

API

base45.encode(input)

This function takes a byte string (the input parameter) and encodes it according to base45. The input data must be in the form of a string containing only characters in the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF or a binary buffer in the same range.

const encodedData = base45.encode(input)

To base45-encode a utf8 encoded string.

import base45 from "@rmhaiderali/base45"
const text = "foo © bar 𝌆 baz"
const encoded = base45.encode(text)
console.log(encoded)
// → 'X.C82EIROA44GECH74C-J1/GUJCW2'

base45.decode(input)

This function takes a base45-encoded string (the input parameter) and decodes it and returns a buffer.

const decodedData = base45.decode(encodedData)
const text = base45.decode(encoded).toString("utf-8")
console.log(text)
// → 'foo © bar 𝌆 baz'

Author

| (https://twitter.com/landgren "Follow @landgren on Twitter") |

License

base45 is available under the MIT license.

About

base45 is a base45 encoder/decoder that is fully compatible draft-faltstrom-base45-02.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%