Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/jyelewis/encode-as-words
- Owner: jyelewis
- Created: 2020-10-18T23:21:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-05T03:48:38.000Z (over 3 years ago)
- Last Synced: 2024-10-15T22:13:40.158Z (4 months ago)
- Language: TypeScript
- Size: 109 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
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.