Финальная часть после тестов скорости шифрования кадров (frames)
This commit is contained in:
@@ -22,12 +22,9 @@ function toUint8Array(input: KeyInput): Uint8Array {
|
||||
|
||||
function fillNonceFromTimestamp(nonce: Uint8Array, tsRaw: unknown): void {
|
||||
nonce.fill(0);
|
||||
|
||||
let ts = 0n;
|
||||
if (typeof tsRaw === "bigint") ts = tsRaw;
|
||||
else if (typeof tsRaw === "number" && Number.isFinite(tsRaw)) ts = BigInt(Math.floor(tsRaw));
|
||||
|
||||
// Записываем 64-bit timestamp в первые 8 байт nonce (BE)
|
||||
nonce[0] = Number((ts >> 56n) & 0xffn);
|
||||
nonce[1] = Number((ts >> 48n) & 0xffn);
|
||||
nonce[2] = Number((ts >> 40n) & 0xffn);
|
||||
|
||||
Reference in New Issue
Block a user