dtf 0.1.0

Obsecure the running time of a function call to diminish timing attacks
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 1 items with examples
  • Size
  • Source code size: 11.91 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.18 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • sbruton/dtf
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sbruton

Deterministic Time Functions

Sync Example

use std::time::Duration;

use dtf::sync::dtf;

let sensitive_method = || {
    if let Some(user) = users.get(user_id) {
        if user.password_hash.validate(password) {
            return Ok(());
        }
    }
    return Err("invalid credentials");
}

let min_duration = Duration::from_millis(1500);
let jitter = Duration::from_millis(100);

let result = dtf(min_duration, jitter, sensitive_method);

Async Example

Requires the async feature be enabled.

use std::time::Duration;

use dtf::future::dtf;

let sensitive_method = async || {
    if let Some(user) = users.get(user_id) {
        if user.password_hash.validate(password) {
            return Ok(());
        }
    }
    return Err("invalid credentials");
}

let min_duration = Duration::from_millis(1500);
let jitter = Duration::from_millis(100);

let result = dtf(min_duration, jitter, sensitive_method).await;