Skip to main content

validate_ecc

Function validate_ecc 

Source
pub fn validate_ecc(data: &[u8]) -> bool
Expand description

Checks whether data is a pristine ECC codeword.

This is an unkeyed Reed-Solomon syndrome check: it detects accidental corruption, not tampering. Authenticity is verified by the Poly1305 tag during decrypt. Returns false for corrupted-but-correctable codewords that decrypt still accepts.

ยงExamples

let data = b"important data";
let encrypted = encrypt(data).expect("encryption failed");
assert!(validate_ecc(&encrypted));