mnemonicToSeed static method

Uint8List mnemonicToSeed(
  1. String mnemonic, {
  2. int entropy = 128,
})

Implementation

static Uint8List mnemonicToSeed(String mnemonic, {int entropy = 128}) {
  if (entropy != 128 && entropy != 256) {
    throw ArgumentError.value(entropy, 'The entropy should be 128 or 256.');
  }

  final salt = Uint8List.fromList(utf8.encode('mnemonic'));

  final keyDerivator = PBKDF2KeyDerivator(HMac(SHA512Digest(), entropy));
  keyDerivator.init(Pbkdf2Parameters(salt, 2048, 64));

  return keyDerivator.process(Uint8List.fromList(utf8.encode(mnemonic)));
}