Created
June 10, 2021 17:06
-
-
Save huksley/c72ee0c2a482ef2e55513e42db4062fa to your computer and use it in GitHub Desktop.
hexspeak generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { customAlphabet } = require("nanoid"); | |
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
const deadbeef = [ | |
"0ff1ce", | |
"10cc", | |
"1ce", | |
"ab1e", | |
"abad", | |
"b00b", | |
"b00b5", | |
"b00c", | |
"b10b", | |
"ba11", | |
"ba5e", | |
"baaad", | |
"baad", | |
"babe", | |
"bad", | |
"beef", | |
"c0de", | |
"ca11", | |
"caca", | |
"cafe", | |
"cefa", | |
"d00d", | |
"d0d0", | |
"dead", | |
"decaf", | |
"def", | |
"defec", | |
"edfe", | |
"f00d", | |
"f01d", | |
"fa11", | |
"face", | |
"face", | |
"fee1", | |
"feed" | |
]; | |
const hexspeak = n => | |
customAlphabet(alphabet.substring(0, deadbeef.length), n)() | |
.split("") | |
.map(s => deadbeef[alphabet.indexOf(s)]) | |
.join(""); | |
console.info(hexspeak(4)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment