wordsToBytesChunk static method
List<int>
wordsToBytesChunk(
- String word1,
- String word2,
- String word3,
- MnemonicWordsList wordsList, {
- Endian endian = Endian.big,
Converts a sequence of three words into a byte chunk using a specified word list.
Implementation
static List<int> wordsToBytesChunk(
String word1,
String word2,
String word3,
MnemonicWordsList wordsList, {
Endian endian = Endian.big,
}) {
final n = wordsList.length();
final word1Idx = wordsList.getWordIdx(word1);
final word2Idx = wordsList.getWordIdx(word2) % n;
final word3Idx = wordsList.getWordIdx(word3) % n;
final intChunk =
word1Idx +
(n * ((word2Idx - word1Idx) % n)) +
(n * n * ((word3Idx - word2Idx) % n));
return IntUtils.toBytes(intChunk, byteOrder: endian, length: 4);
}