/rs-skip-ratchet

Rust implementation of the skip ratchet

Primary LanguageRustApache License 2.0Apache-2.0

Skip Ratchet Logo

Skip Ratchet

This library implements the Skip Ratchet paper. Skip ratchet is a data structure for deriving keys that maintain backward secrecy. Unlike hash chains, this data structure is capable of efficiently making large leaps in hash count.

Usage

Creating a new ratchet and advancing it.

use skip_ratchet::Ratchet;

let mut ratchet = Ratchet::new();
ratchet.inc_by(10);

println!("{}", ratchet.derive_key());

Getting the previous versions of a ratchet.

use skip_ratchet::Ratchet;

let mut old_ratchet = Ratchet::new();
old_ratchet.inc_by(5);

let mut recent_ratchet = old.clone();
recent_ratchet.inc_by(10);

for revision in recent_ratchet.previous(&old_ratchet, 10) {
    println!("{:?}", String::from(&revision));
}

Building the Project

  • Clone the repository.

    git clone https://github.com/WebNativeFileSystem/rs-skip-ratchet.git
  • Change directory

    cd rs-skip-ratchet
  • Run tests

    cargo test --release

Other Implementations