pub enum DigestHash {
Sha1,
Sha256,
}Expand description
Hash algorithm used for computing descriptor digests.
Tor uses cryptographic hashes to identify and verify descriptors. Older descriptor types use SHA-1, while newer ones use SHA-256.
§Example
use stem_rs::descriptor::{compute_digest, DigestHash, DigestEncoding};
let content = b"example content";
let sha1_digest = compute_digest(content, DigestHash::Sha1, DigestEncoding::Hex);
let sha256_digest = compute_digest(content, DigestHash::Sha256, DigestEncoding::Hex);
assert_eq!(sha1_digest.len(), 40); // SHA-1 produces 20 bytes = 40 hex chars
assert_eq!(sha256_digest.len(), 64); // SHA-256 produces 32 bytes = 64 hex charsVariants§
Sha1
SHA-1 hash algorithm (160 bits / 20 bytes).
Used by legacy descriptor types including server descriptors and v2 hidden service descriptors. While SHA-1 is considered weak for collision resistance, it remains in use for backward compatibility.
Sha256
SHA-256 hash algorithm (256 bits / 32 bytes).
Used by modern descriptor types including microdescriptors and v3 hidden service descriptors.
Trait Implementations§
Source§impl Clone for DigestHash
impl Clone for DigestHash
Source§fn clone(&self) -> DigestHash
fn clone(&self) -> DigestHash
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DigestHash
impl Debug for DigestHash
Source§impl PartialEq for DigestHash
impl PartialEq for DigestHash
impl Copy for DigestHash
impl Eq for DigestHash
impl StructuralPartialEq for DigestHash
Auto Trait Implementations§
impl Freeze for DigestHash
impl RefUnwindSafe for DigestHash
impl Send for DigestHash
impl Sync for DigestHash
impl Unpin for DigestHash
impl UnwindSafe for DigestHash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more