Why?
🥴 I was somehow bored and stressed at the same time.
This project demonstrates the use of inline assembly in Rust to implement and benchmark cryptographic algorithms, with a focus on confusing reverse engineers. It includes:
- A
dinoxormodule for obfuscated XOR operations using inline ARM64 assembly and NEON registers. - A
chacha20module for implementing the ChaCha20 stream cipher. - Benchmarking of performance differences between plaintext XOR and inline assembly-based "dinoxor".
The project showcases how to:
- Use the
asm!macro for inline assembly - Access and manipulate registers (e.g.,
v0,w0) - Call helper functions from within assembly
- Manage input/output variables and register bindings
- Manipulate NEON registers for personal gain
- Implements the ChaCha20 stream cipher using Rust's
quickcheckfor testing. - Demonstrates how to replace insecure algorithms like RC4 with modern ciphers.
Performs performance comparisons:
dinoxor(x, y)vs regular eorx ^ y.ChaCha20::process_with_dinoxorvs standard ChaCha20 implementation.
Add this to your Cargo.toml:
[dependencies]
dinoxor = "*"use dinoxor::dinoxor::dinoxor;
let result = dinoxor(0b11101011, 0b11111111);
assert_eq!(result, 0b10100);- Regular XOR:
~6.29 ns/iter - Dinoxor:
~7,095.95 ns/iter
- This project is meant to demonstrate how inline assembly can be used for security through obscurity.
- The implementation of ChaCha20 is for educational purposes only.
This project is released under the MIT License.