encode-as-words
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Encode as words

Encode raw binary data as a collection of human readable words, for easy communication.

e.g. 100101111111100111000100001001111110011100010 => peach den vanity chelsea

Example use case, displaying a users public IP for them to read out over the phone during support calls 142.150.42.3 -> liberals tesco cv

Installation

npm install encode-as-words

or

yarn add encode-as-words

Usage

This package supports both browser environments & node js.

import {encodeBytesAsWords, decodeBytesFromWords} from "encode-as-words";

const ipBytes = new Uint8Array([142, 150, 42, 3]);
const words = encodeBytesAsWords(ipBytes);

console.log(words.join(" ")); // liberals tesco cv

const decodedBytes = decodeBytesFromWords(words, 4);
console.log(decodedBytes); // 142, 150, 42, 3

Security note

This is not a form of encryption. Do not store sensitive data using this package.

Readme

Keywords

Package Sidebar

Install

npm i encode-as-words

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

226 kB

Total Files

19

Last publish

Collaborators

  • jyelewis