luks-core 0.1.6

Pure-Rust LUKS1/LUKS2 reader and decryptor — parse the on-disk header, derive the master key, and decrypt the payload. Panic-free, no unsafe.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Shared helpers for env-gated oracle tests.

#![allow(dead_code)]

use sha2::{Digest, Sha256};

pub fn sha256_hex(bytes: &[u8]) -> String {
    use std::fmt::Write;
    Sha256::digest(bytes)
        .iter()
        .fold(String::new(), |mut s, b| {
            let _ = write!(s, "{b:02x}");
            s
        })
}