This project is a Rabbit stream cipher implementation in both C++ and ARM64 Assembly, designed for performance benchmarking and educational understanding of low-level cryptographic operations.
- Full implementation of Rabbit cipher key setup and encryption
- Parallel C++ and ARM64 Assembly versions for comparison
- Easy-to-read structure for learning or extending the cipher
- Tested with sample plaintext and 128-bit key
Rabbit is a high-speed stream cipher designed for software applications. It was one of the finalists in the eSTREAM project and is known for its balance between performance and security.
.
βββ main.cpp # C++ implementation and test harness
βββ asm.s # ARM64 Assembly implementation of key setup and encryption
βββ README.md # You are here πYou'll need an ARM64 environment (e.g., Apple Silicon Mac or QEMU/VM with ARM64 Linux). Then:
# Assemble and link
as -o asm.o asm.s
g++ -o rabbit main.cpp asm.o
./rabbitThe main.cpp file contains two demos:
main1()uses the C++ implementationmain2()uses the Assembly implementation
Both perform the following:
- Encrypt the string
"Hello, Rabbit Cipher!"using a 128-bit key. - Print the encrypted hex bytes.
- Decrypt the ciphertext to recover the original plaintext.
****************CPP****************
Original: Hello, Rabbit Cipher!
Encrypted: 3F 1A 9C ...
Decrypted: Hello, Rabbit Cipher!
****************ASM****************
Original: Hello, Rabbit Cipher!
Encrypted: 3F 1A 9C ...
Decrypted: Hello, Rabbit Cipher!rabbit_key_setupβ Initializes internal state with the keyrabbit_cryptβ Encrypts or decrypts data using keystream XOR
rabbit_key_setup_β Optimized key setup (.global)rabbit_crypt_β Optimized stream encryption
- Verify correctness and consistency between C++ and Assembly
- Learn inner workings of Rabbit cipher and ARM64 calling conventions
- Explore cryptographic implementation at the hardware level
- Rabbit Cipher Specification (eSTREAM)
- ARM64 Instruction Set Manual
- Cryptography and Network Security by William Stallings (for conceptual clarity)