RustCrypto / block-ciphers

Collection of block cipher algorithms written in pure Rust
671 stars 131 forks source link

XTEA implementation #422

Closed valaphee closed 3 months ago

valaphee commented 5 months ago

This PR implements XTEA as described by various sources, including https://en.wikipedia.org/wiki/XTEA,

XTEA is a historical cipher, which is no longer commonly used today, but some legacy software still uses it to this day.

I tested that the cipher methods get properly unrolled, which boosts a 3x speed increase, and is one of the faster ciphers in this collection. (Hopefully there will be an unroll pragma sometime in the future)

Partially solves https://github.com/RustCrypto/block-ciphers/issues/1

I decided against pre-computing keys as the computation is trivial, and doesn't have a noticeable impact on speed, probably because of memory accesses and that 256 byte don't fit easily in a cache line anyway.