Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jyelewis/encode-as-words

Encode bytes as a human readable string of english words
https://github.com/jyelewis/encode-as-words

Last synced: about 2 months ago
JSON representation

Encode bytes as a human readable string of english words

Awesome Lists containing this project

README

        

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.
``` javascript 1.8
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.