They don’t differ at all. The link in my post simply shows how that particular crate makes use of the wrapping trait more palatable. The key element for me is that use of
pub use core::num::Wrapping as W;
#[allow(non_camel_case_types)]
pub type w32 = W<u32>;
#[allow(non_camel_case_types)]
pub type w64 = W<u64>;
shifts the conceptualization of the crypto algorithms from the infinite ring of all integers, albeit constrained to u32
or u64
(subject to representation overflow or saturation), to the finite rings of 2^32 and 2^64 elements. It’s the clarity in mathematical conceptualization that I find attractive. Use of w32
, w64
and typed constants such as W(0x9b05688c2b3e6c1f)
let Rust’s type-checking detect accidental conflation of the rings. This benefit doesn’t accrue with u32
and u64
and use of lexemes such as *%
for the wrapping operators on those infinite-ring type values.