updates the encryption design doc to use the data size different from initialization vector size

This commit is contained in:
Marcin Czenko 2025-07-03 14:58:51 +02:00
parent 31e26020ba
commit 453906fd47
No known key found for this signature in database
GPG Key ID: 33DEA0C8E30937C0

View File

@ -99,11 +99,12 @@ let blockIndexArray = toBytes(blockIndex, bigEndian)
const KEY_SIZE = 24 # 192 bits for AES-192
const IV_SIZE = 16 # 128 bits
const DefaultBlockSize* = uint 1024 * 64 # as used in Codex
let keyForBlock = hash(addr sha256Vtable, masterKey & @[byte(0x01)] & blockIndexArray.toSeq)[0 ..< KEY_SIZE]
let ivForBlock = hash(addr sha256Vtable, masterKey & @[byte(0x02)] & blockIndexArray.toSeq)[0 ..< IV_SIZE]
var plaintext = newSeqWith(IV_SIZE, Rng.instance.rand(uint8.high).byte)
var plaintext = newSeqWith(DefaultBlockSize.int, Rng.instance.rand(uint8.high).byte)
let key = keyForBlock
let ive = ivForBlock