Skip to content

crypto/hmac: panics #45252

Description

@Mr-Leshiy

Hello I have found a weird behaviour of the sha256 Reset() method with the hmac. So I have the following question.
Why does this example produce panics ?

sha256Hash := sha256.New()

salt := []byte{1, 2, 3}

hmac.New(func() hash.Hash {
	sha256Hash.Reset()
	return sha256Hash
}, salt)
panic: crypto/hmac: hash generation function does not produce unique values

But this example does not produce panics

salt := []byte{1, 2, 3}

hmac.New(func() hash.Hash {
	return sha256.New()
}, salt)

What is the difference between these examples.

Activity

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

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions