pub struct DataFingerprint { /* private fields */ }Expand description
Fast integrity check for account data using FNV-1a hash.
Use this to detect unexpected data mutations around CPI calls. Not cryptographically secure – purely for integrity assertions.
Implementations§
Source§impl DataFingerprint
impl DataFingerprint
Sourcepub fn capture(account: &AccountView, len: usize) -> Self
pub fn capture(account: &AccountView, len: usize) -> Self
Compute a fast fingerprint of the first len bytes of account data.
Uses FNV-1a (fast, no dependencies, good collision resistance for short inputs). Not suitable for cryptographic purposes.
Sourcepub fn verify_unchanged(&self, account: &AccountView) -> ProgramResult
pub fn verify_unchanged(&self, account: &AccountView) -> ProgramResult
Verify the data has not changed since the snapshot.
Trait Implementations§
Source§impl Clone for DataFingerprint
impl Clone for DataFingerprint
Source§fn clone(&self) -> DataFingerprint
fn clone(&self) -> DataFingerprint
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 DataFingerprint
impl Debug for DataFingerprint
impl Copy for DataFingerprint
Auto Trait Implementations§
impl Freeze for DataFingerprint
impl RefUnwindSafe for DataFingerprint
impl Send for DataFingerprint
impl Sync for DataFingerprint
impl Unpin for DataFingerprint
impl UnsafeUnpin for DataFingerprint
impl UnwindSafe for DataFingerprint
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