https://github.com/jtdowney/speck
Toy implementation of Speck cipher in Rust
https://github.com/jtdowney/speck
cipher cryptography speck
Last synced: 7 months ago
JSON representation
Toy implementation of Speck cipher in Rust
- Host: GitHub
- URL: https://github.com/jtdowney/speck
- Owner: jtdowney
- License: mit
- Created: 2022-11-07T03:27:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-07T11:58:27.000Z (almost 3 years ago)
- Last Synced: 2025-02-01T11:41:33.396Z (9 months ago)
- Topics: cipher, cryptography, speck
- Language: Rust
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# speck
This is a Rust implementation of the [Speck cipher](https://eprint.iacr.org/2013/404.pdf). I built it as a quick experiment to see how I'd implement it with `#[no_std]` Rust and have no intention of putting it into production use. It does pass the test vectors from the paper, [after they were converted to little-endian](https://en.wikipedia.org/wiki/Speck_(cipher)#Endianness).
## Example
```rust
let id = 456789;
let cipher = Speck64_128::new([0, 1, 3, 4]);
let mut data = id.to_le_bytes();
cipher.seal_in_place(&mut data).unwrap();
let encrypted_id = u64::from_le_bytes(data)
// => 6883383884621847717
```