@coast-team/mnemonicjs

JavaScript port of the mnemonic encoder originally written in C by Oren Tirosh

Usage no npm install needed!

<script type="module">
  import coastTeamMnemonicjs from 'https://cdn.skypack.dev/@coast-team/mnemonicjs';
</script>

README

This is a direct JavaScript port of the mnemonic encoder originally written in C by Oren Tirosh and available from:

https://github.com/singpolyma/mnemonicode

These routines implement a method for encoding binary data into a sequence of words which can be spoken over the phone, for example, and converted back to data on the other side.

For more information, see:

http://web.archive.org/web/20101031205747/http://www.tothink.com/mnemonic/

Example usage:

>>> mnemonic.encode([101, 2, 240, 6, 108, 11, 20, 97])
"digital-apollo-aroma--rival-artist-rebel"

>>> mnemonic.encode([101, 2, 240, 6, 108, 11, 20, 97], "x/x/x - ")
"digital/apollo/aroma - rival/artist/rebel"

>>> mnemonic.decode("digital.apollo.aroma.rival.artist.rebel")
[101, 2, 240, 6, 108, 11, 20, 97]

>>> mnemonic.encode_int32(438871)
"judo-fluid-jet"

>>> mnemonic.decode_int32("judo-fluid-jet")
438871

Available under the MIT license.