Crates.io | common-crypto |
lib.rs | common-crypto |
version | 0.3.0 |
source | src |
created_at | 2021-02-20 18:37:44.034452 |
updated_at | 2021-02-22 08:52:00.041611 |
description | Bindings to Apple's Common Crypto library |
homepage | |
repository | https://github.com/steven-joruk/common-crypto |
max_upload_size | |
id | 358118 |
size | 27,688 |
Bindings for Apple's Common Crypto APIs.
[dependencies]
common-crypto = "0.3"
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");
let hash = Hash::sha256(b"data");
let mut hasher = hash::SHA256::new();
hasher.update(b"data");
hasher.update(b"more data");
let hash = hasher.finish();
let auth_code = HMAC::sha512(b"Key", b"Input");
let mut hasher = hmac::SHA256::new(b"Key");
hasher.update(b"data");
hasher.update(b"more data");
let hash = hasher.finish();
Feel free to contribute in any way you like.