Windows Asm Hash is incorrect
- env
CC_x86_64-pc-windows-gnu = "x86_64-w64-mingw32-gcc"
- toolchain
stable-x86_64-pc-windows-gnu
$: rustc --version
rustc 1.78.0 (9b00956e5 2024-04-29)
$: x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc.exe (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$: Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
WindowsProductName WindowsVersion OsHardwareAbstractionLayer
------------------ -------------- --------------------------
Windows Server 2022 Datacenter 2009 10.0.20348.2031
- Dependencies
sha2 = { version = "0.10.8", features = ["asm"] }
- In Rust
let mut r = sha2::Sha256::new();
r.update(b"hello\n");
println!("{:x}", r.finalize());
// out:
// 6a09e667bb67ae853c6ef372a54ff53a510e527f9b05688c1f83d9ab5be0cd19
- In Python
r = hashlib.sha256(b"hello\n").hexdigest()
print(r)
# out
# 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03
Could you look into generated assembly? And check if the incorrect behavior is reproducible with other Rust versions? It's probably caused by some weird ABI issue...
We probably should simply raise compilation error when these crates get compiled on Windows, regardless whether it's MSVC or GNU toolchain.
Could you look into generated assembly? And check if the incorrect behavior is reproducible with other Rust versions? It's probably caused by some weird ABI issue...
We probably should simply raise compilation error when these crates get compiled on Windows, regardless whether it's MSVC or GNU toolchain.
It's the same with toolchain
1.70-x86_64-pc-windows-gnu