in packages/fb-tiger-hash/src/Tiger.js [35:66]
function _getMessage(buffer /*: Buffer*/) /*: Array<BigInt>*/ {
const words = [];
let word = 0n;
let byteLen = 0n;
for (const c of buffer) {
const b = byteLen++ & 0x7n;
word |= BigInt(c) << (b << 3n);
if (byteLen % 8n == 0n) {
words.push(word);
word = 0n;
}
}
// Store original size (in bits)
const bitSize = (byteLen << 3n) & U64;
// Pad our message with a byte of 0x1 ala MD4 (Tiger1) padding
const b = byteLen & 0x7n;
if (b) {
word |= 0x1n << (b << 3n);
words.push(word);
byteLen += 8n - b;
} else {
words.push(0x1n);
byteLen += 8n;
}
for (byteLen %= 64n; byteLen < 56n; byteLen += 8n) {
words.push(0n);
}
words.push(bitSize);
return words;
}