Skip to main content

keys_eq_bytes

Function keys_eq_bytes 

Source
pub fn keys_eq_bytes(a: &[u8], b: &[u8; 32]) -> bool
Expand description

Fast key equality between an arbitrary byte slice and a 32-byte key.

Returns false unless a.len() == 32; otherwise performs the same 4 x u64 word comparison as keys_eq. This serves call sites that hold a slice view into account data (e.g. an SPL token account’s owner field at data[32..64]) and want to compare against an expected key without first copying 32 bytes into a temporary array.