TEA Encrypt

Category: Ciphers

Status: Registered and callable in the CyberChef 11.3.0 compatibility inventory.

Input / output: string → string

Background: https://wikipedia.org/wiki/Tiny_Encryption_Algorithm

What it does

TEA (Tiny Encryption Algorithm) is a block cipher designed by David Wheeler and Roger Needham in 1994. It operates on 64-bit blocks using a 128-bit key and performs 32 cycles (64 Feistel rounds) with the DELTA constant 0x9E3779B9 derived from the golden ratio. TEA is notable for its simplicity and compact implementation, making it frequently encountered in malware analysis and CTF challenges. Despite its elegance, TEA has known weaknesses including equivalent keys and susceptibility to related-key attacks, leading to successors XTEA and XXTEA. Key: Must be exactly 16 bytes (128 bits). IV: The Initialisation Vector should be 8 bytes (64 bits). If not entered, it will default to null bytes. Padding: In CBC and ECB mode, the PKCS#5 padding scheme is used.

Note

Status here means the operation name is implemented and callable. It does not by itself promise byte-for-byte parity for every upstream option. See Compatibility and current status for the verified scope and known boundaries.

Arguments and options

Arguments are positional. Keep their order when using bake() or Pipeline.then().

Index

Name

UI type

PyChef default

Accepted values / format

0

Key

toggleString

{'string': '', 'option': 'Hex'}

''

1

IV

toggleString

{'string': '', 'option': 'Hex'}

''

2

Mode

option

'CBC'

'CBC', 'CFB', 'OFB', 'CTR', 'ECB'

3

Input

option

'Raw'

'Raw', 'Hex'

4

Output

option

'Hex'

'Hex', 'Raw'

5

Padding

option

'PKCS5'

'PKCS5', 'NO', 'ZERO', 'RANDOM', 'BIT'

6

Rounds

value

32

Any value supported by this argument type

Recipe template

Important

This is a call template built from the documented defaults. Replace placeholder values such as empty keys, paths, patterns, or lookup data before running it.

from pychef import bake

input_value = "example"
args = [{'string': '', 'option': 'Hex'}, {'string': '', 'option': 'Hex'}, 'CBC', 'Raw', 'Hex', 'PKCS5', 32]
result = bake(input_value, [{"op": 'TEA Encrypt', "args": args}])
print(result)

Pipeline example

from pychef import Pipeline

args = [{'string': '', 'option': 'Hex'}, {'string': '', 'option': 'Hex'}, 'CBC', 'Raw', 'Hex', 'PKCS5', 32]
transform = Pipeline().then('TEA Encrypt', *args)
result = transform("example")

Dedicated operation module

The registered entry point lives in pychef.operations.by_operation.tea_encrypt. Direct calls receive the input value and a positional argument tuple:

from pychef.operations.by_operation.tea_encrypt import run

result = run("example", tuple([{'string': '', 'option': 'Hex'}, {'string': '', 'option': 'Hex'}, 'CBC', 'Raw', 'Hex', 'PKCS5', 32]))
pychef.operations.by_operation.tea_encrypt.run(value, args)

Run this operation using its shared internal implementation.

Parameters:
  • value (str | bytes)

  • args (Sequence[Any])

Return type:

str | bytes