uutils/coreutils

uu shred has a different probability distribution of overwrites from GNU shred

Open

#11.611 geöffnet am 3. Apr. 2026

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Rust (1.852 Forks)batch import
U - shredgood first issuereported-canonical-2

Repository-Metriken

Stars
 (23.246 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 9T 14h) (216 gemergte PRs in 30 T)

Beschreibung

uu shred implements both algorithms, and the following test demonstrates that, for 1000 passes, uu shred's default algorithm has 246 multibyte overwrites, in contrast to 318 for GNU's.

#[test]
fn test_pattern_multicount() {
    use std::{cell::RefCell, fs::OpenOptions, io::Write};
    let mut f = OpenOptions::new().read(true).write(true).create(true).truncate(true).open("/tmp/uu_shred_test_pattern").unwrap();
    // create_test_compatible_sequence requires that the random source consist of only 0x55's
    f.write(&[0x55; 1024]).unwrap();
    f.flush().unwrap();
    let rng = Some(RefCell::new(f));
    let n = 1000;
    let a = crate::create_test_compatible_sequence(n, rng.as_ref()).unwrap();
    let b = crate::create_standard_pass_sequence(n).unwrap();
    use crate::{PassType,Pattern};
    println!("a {:?}", a.iter().filter(|x| matches!(x, PassType::Pattern(Pattern::Multi(_)))).count());
    println!("b {:?}", b.iter().filter(|x| matches!(x, PassType::Pattern(Pattern::Multi(_)))).count());
}

Contributor Guide