common-crypto

github action crates.io docs.rs

Bindings for Apple's Common Crypto APIs.

Examples

toml [dependencies] common-crypto = "0.3"

Cryptor

```rust let config = Config::AES256 { mode: Mode::CTR, iv: Some(b"use random iv :)"), key: b"0123456789abcdef0123456789abcdef", };

let encrypted = Cryptor::encrypt(&config, b"Hello").unwrap(); let decrypted = Cryptor::decrypt(&config, encrypted).unwrap(); assert_eq!(decrypted, b"Hello"); ```

Hash

rust let hash = Hash::sha256(b"data");

rust let mut hasher = hash::SHA256::new(); hasher.update(b"data"); hasher.update(b"more data"); let hash = hasher.finish();

HMAC

rust let auth_code = HMAC::sha512(b"Key", b"Input");

rust let mut hasher = hmac::SHA256::new(b"Key"); hasher.update(b"data"); hasher.update(b"more data"); let hash = hasher.finish();

What's missing?

Contributing

Feel free to contribute in any way you like.