vishalpatelct / PyTEA

A Python implementation of the Tiny Encryption Algorithm (TEA)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyTEA

A Python implementation of the Tiny Encryption Algorithm, this is NOT a secure cipher, do not use it for anything important - it's just a fun toy. Can be used as a library, or via a cli.

TEA has a few weaknesses. Most notably, it suffers from equivalent keys—each key is equivalent to three others, which means that the effective key size is only 126 bits. As a result, TEA is especially bad as a cryptographic hash function. This weakness led to a method for hacking Microsoft's Xbox game console (where I first encountered it), where the cipher was used as a hash function. TEA is also susceptible to a related-key attack which requires 2^23 chosen plaintexts under a related-key pair, with 2^32 time complexity.

TODO

  • Does not currently implement CBC

CLI Usage

usage: tea.py [-h] [--encrypt EPATH] [--decrypt DPATH] [--verbose]

Python implementation of the TEA cipher

optional arguments:
  -h, --help            show this help message and exit
  --encrypt EPATH, -e EPATH
                        encrypt a file
  --decrypt DPATH, -d DPATH
                        decrypt a file
  --verbose             display verbose output

Library Usage

import tea

key = get_key('Random Text or Something')
cipher_text = tea.encrypt('somedata', key)
plaint_text = tea.decrypt(cipher_text, key)

About

A Python implementation of the Tiny Encryption Algorithm (TEA)


Languages

Language:Python 100.0%