Mnemonic Phrase

Create mnemonic phrases from HEX strings and vice-versa.

Used in the Nimiq blockchain to create mnemonic phrases from private keys.


In HTML as a standard script tag:

<script type="text/javascript" src="mnemonic-phrase.es5.min.js"></script>

If using JS imports:

import MnemonicPhrase from '/path/to/mnemonic-phrase.min.js';
// The input HEX string must be 16-32 bytes long.
var key = 'a18532abfb31ba4e26d64a3ac3430969639aeb5f84b1c4124da0f3e323cdaced';

var mnemonic = MnemonicPhrase.keyToMnemonic(key);
// Result: 'pave civil priority wait brick check opera sing depart borrow seat spot defy interest lawn normal series mystery habit treat cram traffic recipe risk'

var key = MnemonicPhrase.mnemonicToKey(mnemonic);
// Result: 'a18532abfb31ba4e26d64a3ac3430969639aeb5f84b1c4124da0f3e323cdaced'

Based on