computeChecksum static method
Computes the checksum word for a list of Monero mnemonic words.
-mnemonic: The list of Monero mnemonic words for which to compute the checksum.
-language: The Monero language used in the mnemonic.
Implementation
static String computeChecksum(
List<String> mnemonic,
MoneroLanguages language,
) {
final uniqueLen = language.prefixLen;
final String prefixes =
mnemonic.map((word) {
final len = word.length >= uniqueLen ? uniqueLen : word.length;
return word.substring(0, len);
}).join();
final int index =
Crc32().quickIntDigest(StringUtils.encode(prefixes)) % mnemonic.length;
return mnemonic[index];
}