Skip to content

Instantly share code, notes, and snippets.

@webmaster128
Created August 4, 2019 16:34
Show Gist options
  • Save webmaster128/bb0230bf8a57afa7835bdf89336c9bf5 to your computer and use it in GitHub Desktop.
Save webmaster128/bb0230bf8a57afa7835bdf89336c9bf5 to your computer and use it in GitHub Desktop.
Retoring original mnemonic from part 1 and part 2 using @iov/crypto
const part1 = 'pencil accuse tennis element peanut tent venue message process stove glory gym'
const part2 = 'panic roof boil axis mom enjoy change margin stove heavy forum food'
const part1Entropy = Bip39.decode(new EnglishMnemonic(part1))
const part2Entropy = Bip39.decode(new EnglishMnemonic(part2))
const restoredEntropy = part1Entropy.map((byte, index) => byte ^ part2Entropy[index])
const restored = Bip39.encode(restoredEntropy).toString()
// 'dial ring shiver firm connect nominee stairs army large rubber deal crater'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment