1
0

chore: use "is_multiple_of" method

This commit is contained in:
2025-10-07 22:40:31 +08:00
parent e0f9dadfc6
commit 1f7c4e6571
3 changed files with 85 additions and 7 deletions

View File

@@ -77,7 +77,7 @@ impl MT19937 {
for i in 0..624 {
let y: u32 = (self.mt[i] & 0x80000000) + (self.mt[(i + 1) % 624] & 0x7fffffff);
self.mt[i] = self.mt[(i + 397) % 624] ^ (y >> 1);
if y % 2 != 0 {
if !y.is_multiple_of(2) {
self.mt[i] ^= 0x9908b0df;
}
}

View File

@@ -100,7 +100,6 @@
// w[i] = (w[i-6] xor w[i-16] xor w[i-28] xor w[i-32]) leftrotate 2
// This transformation keeps all operands 64-bit aligned and, by removing the dependency of w[i] on w[i-3], allows efficient SIMD implementation with a vector length of 4 like x86 SSE instructions.
use hex;
use sha1::{Digest, Sha1};
fn sha1(input: &[u8]) -> [u8; 20] {