Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong hash value returned in go v1.16.2 on arm64 #17

Closed
gabrielbulancea opened this issue Mar 25, 2021 · 4 comments · Fixed by #19
Closed

Wrong hash value returned in go v1.16.2 on arm64 #17

gabrielbulancea opened this issue Mar 25, 2021 · 4 comments · Fixed by #19
Assignees

Comments

@gabrielbulancea
Copy link

Hello,

It appears that highwayhash returns a different hash in applications built with go v1.16.2 on linux/arm64.
Below you can find the sample code:

package main

import (
	"fmt"

	"github.com/minio/highwayhash"
)

var zeroHashKey = make([]byte, 32)

func main() {
	h, err := highwayhash.New(zeroHashKey)
	if err != nil {
		panic(err)
	}

	h.Write([]byte("highwayhash"))
	var r []byte

	fmt.Printf("%X\n", h.Sum(r))
}

It was build with:

  • go version go1.14.15 linux/arm64
    Output: 9CDC5F01022BDA9C24EF02BF64FB0D08BF7A55C9BD672D1AF16C25BB68047A60

  • go version go1.16.2 linux/arm64
    Output: 3A6E473DFDAB6331F90B3160D586CC1E05CAFFB09F854935991C026E7A1D4B59

  • the Go Playground running go1.16.2
    Output: 9CDC5F01022BDA9C24EF02BF64FB0D08BF7A55C9BD672D1AF16C25BB68047A60

  • go version go1.16.2 windows/amd64
    Output: 9CDC5F01022BDA9C24EF02BF64FB0D08BF7A55C9BD672D1AF16C25BB68047A60

Highway version: v1.0.1
As you can see, in go1.16.2 linux/arm64 a wrong value is returned, even on different hosts.

@klauspost klauspost self-assigned this Mar 25, 2021
@klauspost
Copy link
Contributor

@gabrielbulancea If you add -tags=noasm I presume the output is correct?

@gabrielbulancea
Copy link
Author

Yes, everything works as expected

klauspost added a commit to klauspost/highwayhash that referenced this issue Mar 25, 2021
The wrong constants were used for ARM64, leading to wrong values being calculated.
This is likely due to a linker change or similar.

* Rename to less generic names.
* Use textflag.h
* Apply asmfmt

Fixes minio#17
harshavardhana pushed a commit that referenced this issue Mar 25, 2021
The wrong constants were used for ARM64, leading to wrong values being calculated.
This is likely due to a linker change or similar.

* Rename to less generic names.
* Use textflag.h
* Apply asmfmt

Fixes #17

* Re-enable asm...
@klauspost
Copy link
Contributor

@gabrielbulancea Thanks for reporting this!

@gabrielbulancea
Copy link
Author

Thank you for your awesome support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants