Skip to Content
oxcrypto

BelT-CTR

BelT counter mode from STB 34.101.31.

from oxcrypto.cipher.belt_ctr import BELT_CTR

mode = BELT_CTR.BELT_CTR
key, iv = bytes(32), bytes(16)
ciphertext = mode.encrypt(key, b"hello", iv=iv)
context = mode.decryptor(key, iv=iv)
context.seek(1)
assert context.update(ciphertext[1:]) == b"ello" and context.position == 5

Standard: STB 34.101.31-2020. The key is 32 bytes and the IV 16 bytes. Contexts support seek and position.