rc_protocol

Crates.iorc_protocol
lib.rsrc_protocol
version1.0.0
sourcesrc
created_at2022-08-05 12:15:39.905358
updated_at2022-08-05 12:15:39.905358
descriptionRust implementation of the Random Checksum Protocol
homepagehttps://github.com/gammelalf/rcp-rs/
repositoryhttps://github.com/gammelalf/rcp-rs/
max_upload_size
id639309
size12,709
(gammelalf)

documentation

README

rcp-rs

Implemention of RCP in rust

Usage

use std::collections::HashMap;
use rc_protocol::RCPConfig;

// Config is used to create a checksum as well as validate a checksum
let config = RCPConfig {
  shared_secret: "Shared Secret Key".to_string(),
  use_time_component: true,
  time_delta: 5,
};

let mut m = HashMap::new();
m.insert("key1", "value1");
m.insert("key2", "value2");

// Get the checksum for a given dictionary
let checksum = config.get_checksum(&m, "TestSalt"); 

// Validate a given checksum
if !config.validate_checksum(&m, "TestSalt", &checksum) {
     println!("Checksum was incorrect");
}
Commit count: 3

cargo fmt