| Crates.io | cyfs-ecies |
| lib.rs | cyfs-ecies |
| version | 0.1.4 |
| created_at | 2022-06-01 08:37:49.505223+00 |
| updated_at | 2022-06-01 08:37:49.505223+00 |
| description | Elliptic Curve Integrated Encryption Scheme for secp256k1 in Rust |
| homepage | https://github.com/ecies/rs |
| repository | https://github.com/ecies/rs |
| max_upload_size | |
| id | 598044 |
| size | 16,967 |
Elliptic Curve Integrated Encryption Scheme for secp256k1 in Rust, based on pure Rust implementation of secp256k1.
This is the Rust version of eciespy.
pub fn encrypt(receiver_pub: &[u8], msg: &[u8]) -> Result<Vec<u8>, SecpError>
pub fn decrypt(receiver_sec: &[u8], msg: &[u8]) -> Result<Vec<u8>, SecpError>
const MSG: &str = "helloworld";
let (sk, pk) = generate_keypair();
let (sk, pk) = (&sk.serialize(), &pk.serialize());
let msg = MSG.as_bytes();
assert_eq!(
msg,
decrypt(sk, &encrypt(pk, msg).unwrap()).unwrap().as_slice()
);