Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Windows Asm Hash is incorrect #78

Closed

Description

@MaxKingPor
  • 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

Activity

  1. changed the title [-]Windaus Hash is incorrect[/-] [+]Windows Asm Hash is incorrect[/+] on May 4, 2024
  2. newpavlov commented on May 5, 2024

    @newpavlov
    Member

    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.

  3. MaxKingPor commented on May 6, 2024

    @MaxKingPor
    Author

    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.

    image
    It's the same with toolchain 1.70-x86_64-pc-windows-gnu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions