| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.102.0/docs/apis/_sources/ctr_0.rst.txt |
.. index:: single: ctr .. _ctr/0:
.. rst-class:: right
object
ctrGeneric Counter mode encryption and decryption using a whole-block big-endian counter.
| Availability:
| logtalk_load(block_ciphers(loader))
| Author: Paulo Moura | Version: 1:0:0 | Date: 2026-08-08
| Compilation flags:
| static, context_switching_calls
| Imports:
| public :ref:`block_cipher_modes_common <block_cipher_modes_common/0>`
| Remarks: | (none)
| Inherited public predicates: | (none)
.. contents:: :local: :backlinks: top
.. index:: crypt/5 .. _ctr/0::crypt/5:
crypt/5 ^^^^^^^^^^^
Encrypts or decrypts bytes using an explicit initial whole-block big-endian counter. The counter is incremented internally while processing the input but is not returned. The client is responsible for managing initial counters across calls and preventing reuse of a counter sequence with the same key.
| Compilation flags:
| static
| Template:
| crypt(Cipher,Key,InitialCounter,Input,Output)
| Mode and number of proofs:
| crypt(+object_identifier,+list(byte),+list(byte),+list(byte),--list(byte)) - one_or_error
| Exceptions:
| Cipher is a variable:
| instantiation_error
| Cipher is neither a variable nor a prepared-key block cipher object:
| domain_error(block_cipher,Cipher)
| InitialCounter is not a byte list of exactly one block:
| type_error(list(byte,BlockSize),InitialCounter)
| Input is a variable or a partial list:
| instantiation_error
| Input is neither a partial list nor a list:
| type_error(list,Input)
| An element Byte of the Input list is neither a variable nor an integer:
| type_error(integer,Byte)
| An element Byte of the Input list is an integer but not a valid byte:
| domain_error(byte,Byte)
.. index:: crypt/6 .. _ctr/0::crypt/6:
crypt/6 ^^^^^^^^^^^
Encrypts or decrypts bytes using an explicit initial whole-block big-endian counter and returns the next unused counter. The final counter equals the initial counter for empty input and is otherwise incremented once per processed input block, modulo the counter width.
| Compilation flags:
| static
| Template:
| crypt(Cipher,Key,InitialCounter,Input,FinalCounter,Output)
| Mode and number of proofs:
| crypt(+object_identifier,+list(byte),+list(byte),+list(byte),--list(byte),--list(byte)) - one_or_error
| Exceptions:
| Cipher is a variable:
| instantiation_error
| Cipher is neither a variable nor a prepared-key block cipher object:
| domain_error(block_cipher,Cipher)
| InitialCounter is not a byte list of exactly one block:
| type_error(list(byte,BlockSize),InitialCounter)
| Input is a variable or a partial list:
| instantiation_error
| Input is neither a partial list nor a list:
| type_error(list,Input)
| An element Byte of the Input list is neither a variable nor an integer:
| type_error(integer,Byte)
| An element Byte of the Input list is an integer but not a valid byte:
| domain_error(byte,Byte)
(no local declarations; see entity ancestors if any)
(no local declarations; see entity ancestors if any)
(none)