Function sodiumoxide::crypto::verify::verify_64
[−]
[src]
pub fn verify_64(x: &[u8; 64], y: &[u8; 64]) -> bool
verify_64()
returns true if x[0]
, x[1]
, ..., x[63]
are the
same as y[0]
, y[1]
, ..., y[63]
. Otherwise it returns false
.
This function is safe to use for secrets x[0]
, x[1]
, ..., x[63]
,
y[0]
, y[1]
, ..., y[63]
. The time taken by verify_64
is independent
of the contents of x[0]
, x[1]
, ..., x[63]
, y[0]
, y[1]
, ..., y[63]
.
In contrast, the standard C comparison function memcmp(x,y,64)
takes time
that depends on the longest matching prefix of x
and y
, often allowing easy
timing attacks.