pub enum PimdirHashAlgo {
Blake3,
Sha256_128,
}Expand description
The hash a store names its objects by, as store_meta.hash_algo
records it.
Variants§
Blake3
BLAKE3, the whole 256-bit digest, which the spec recommends.
Sha256_128
SHA-256 truncated to its first 128 bits, for a consumer whose platform ships SHA-256 and would otherwise bundle a BLAKE3 implementation (the Android app takes this one).
Content addressing needs collision resistance, not signature strength, and a 26-character name keeps the blob paths short.
Implementations§
Source§impl PimdirHashAlgo
impl PimdirHashAlgo
Sourcepub fn parse(algo: &str) -> Option<Self>
pub fn parse(algo: &str) -> Option<Self>
The algorithm a stored spelling names, or None for one this
crate does not implement, which a caller reports rather than
guessing around.
Sourcepub fn hash(&self, bytes: &[u8]) -> ReplicaHash
pub fn hash(&self, bytes: &[u8]) -> ReplicaHash
The content hash of a whole body.
Sourcepub fn hasher(&self) -> PimdirHasher
pub fn hasher(&self) -> PimdirHasher
An incremental hasher, for a body streamed into the blob store
rather than held whole in memory (spec §14’s byteless
StoreObject).
Trait Implementations§
Source§impl Clone for PimdirHashAlgo
impl Clone for PimdirHashAlgo
Source§fn clone(&self) -> PimdirHashAlgo
fn clone(&self) -> PimdirHashAlgo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PimdirHashAlgo
Source§impl Debug for PimdirHashAlgo
impl Debug for PimdirHashAlgo
Source§impl Default for PimdirHashAlgo
impl Default for PimdirHashAlgo
Source§fn default() -> PimdirHashAlgo
fn default() -> PimdirHashAlgo
Returns the “default value” for a type. Read more
impl Eq for PimdirHashAlgo
Source§impl PartialEq for PimdirHashAlgo
impl PartialEq for PimdirHashAlgo
impl StructuralPartialEq for PimdirHashAlgo
Auto Trait Implementations§
impl Freeze for PimdirHashAlgo
impl RefUnwindSafe for PimdirHashAlgo
impl Send for PimdirHashAlgo
impl Sync for PimdirHashAlgo
impl Unpin for PimdirHashAlgo
impl UnsafeUnpin for PimdirHashAlgo
impl UnwindSafe for PimdirHashAlgo
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