:param s: S-box
:param _in: 32-bit word
- :return: substituted 32-bit word
+ :returns: substituted 32-bit word
"""
return (
(s[0][(_in >> 0) & 0x0F] << 0) +
:param bytes key: 256-bit encryption key
:param ns: N1 and N2 integers
:type ns: (int, int)
- :return: resulting N1 and N2
+ :returns: resulting N1 and N2
:rtype: (int, int)
"""
s = SBOXES[sbox]
:param bytes key: encryption key
:param data: plaintext
:type data: bytes, multiple of BLOCKSIZE
- :param func action: encrypt/decrypt
+ :param func action: "encrypt"/"decrypt"
:param sbox: S-box parameters to use
:type sbox: str, SBOXES'es key
- :return: ciphertext
+ :returns: ciphertext
:rtype: bytes
"""
validate_key(key)
:type bool pad: perform ISO/IEC 7816-4 padding
:param sbox: S-box parameters to use
:type sbox: str, SBOXES'es key
- :return: ciphertext
+ :returns: ciphertext
:rtype: bytes
34.13-2015 padding method 2 is used.
:type bool pad: perform ISO/IEC 7816-4 unpadding after decryption
:param sbox: S-box parameters to use
:type sbox: str, SBOXES'es key
- :return: plaintext
+ :returns: plaintext
:rtype: bytes
"""
validate_key(key)
:type iv: bytes, BLOCKSIZE length
:param sbox: S-box parameters to use
:type sbox: str, SBOXES'es key
- :return: ciphertext
+ :returns: ciphertext
:rtype: bytes
For decryption you use the same function again.
:param sbox: S-box parameters to use
:type sbox: str, SBOXES'es key
:param bool mesh: enable key meshing
- :return: ciphertext
+ :returns: ciphertext
:rtype: bytes
"""
validate_key(key)
:param sbox: S-box parameters to use
:type sbox: str, SBOXES'es key
:param bool mesh: enable key meshing
- :return: ciphertext
+ :returns: ciphertext
:rtype: bytes
"""
validate_key(key)