Created
August 4, 2019 16:16
-
-
Save webmaster128/063aa1b2f32ff07545fcf26b9a893982 to your computer and use it in GitHub Desktop.
Split mnemonic in two parts using @iov/crypto
This file contains hidden or 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 original = 'dial ring shiver firm connect nominee stairs army large rubber deal crater' | |
const entropy = Bip39.decode(new EnglishMnemonic(original)) | |
const part1Entropy = await Random.getBytes(entropy.length /* 16 bytes */) | |
const part2Entropy = entropy.map((byte, index) => byte ^ part1Entropy[index]) | |
const part1 = Bip39.encode(part1Entropy).toString() | |
// 'pencil accuse tennis element peanut tent venue message process stove glory gym' | |
const part2 = Bip39.encode(part2Entropy).toString() | |
// 'panic roof boil axis mom enjoy change margin stove heavy forum food' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment