Crates.io | ope |
lib.rs | ope |
version | 0.1.1 |
source | src |
created_at | 2023-07-16 14:27:48.777642 |
updated_at | 2023-07-16 14:29:35.906405 |
description | This is an Order-preserving encryption (OPE) lib inspired by cryptdb's ope implementation. |
homepage | |
repository | https://github.com/sentclose/ope |
max_upload_size | |
id | 917784 |
size | 16,616 |
This is an Order-preserving encryption (OPE) lib inspired by cryptdb's ope implementation.
It is a pure rust implementation, no c dependencies needed.
It is also written for no-std targets (thanks to num-traits) and works in wasm.
The max value to encrypt is 65532
use ope_rs::get_ope;
fn main()
{
let k = b"this is a key 10".to_owned();
let ope = get_ope(&k);
let a = ope.encrypt(21).unwrap();
let b = ope.encrypt(65531).unwrap();
let c = ope.encrypt(65532).unwrap();
assert!(a < b);
assert!(b < c);
}