Skip to content

jyelewis/encode-as-words

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Encode bytes as a human readable string of english words

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published