Skip to content

Documentation

Varbin edited this page Jul 12, 2014 · 33 revisions

XTEA documentation

This is the documentation of the encryption part of xtea in python.


|Content |

Functions

New in 0.3.0: Added CFB-mode
New in 0.4.0: Added CMAC
New in 0.4.0: Added bugless and PEP-like CTR

function new(key, **kwargs):

Constructor for an "XTEACipher" object
  • key - a string, must have a length of 8 (128-bits)

  • Optional parameters:

  • MODE - int or long, must be one of the following (default 1):

    • 1 (ECB)
    • 2 (CBC)
    • 3 (CFB)
    • 5 (OFB)
    • 6 (CTR) - Buggy (you may loose data)

    Number 4 is the OpenPGP format, it is not used (see more at PEP 272. If 4 is given to the function, a NotImplementedError will be raised.

  • IV - string, must have a length of one block (8), needed with CBC and CFB, optional with OFB, if not given in CBC/CFB, raises a value error

  • counter - callable function/object, the counter function for CTR, must return a number (int or long) or a string (0.4.0+)

  • endian - on of the strings "@", "=", "<", ">" or "!", look in the struct documentation for details, (default is "!", its the same as ">" (network/big endian)).

  • rounds - int or long, rounds for the cipher; more rounds = more security = more slowness; 2 rounds = 1 cycle

Clone this wiki locally