Documentation
¶
Overview ¶
Package hashing contains simple hashing functionality. This is NOT meant for passwords, but rather for simply verifying the integrity of a message using a secret.
Note this does not allow for any other party to verify authenticity of a message, as the secret should not be shared.
Index ¶
Constants ¶
const HMACKeySize = 64
HMACKeySize is the expected size of an HMAC hashing key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HMACKey ¶
type HMACKey [HMACKeySize]byte
HMACKey is a secret key used for message hashing using HMAC+SHA256.
I've chosen to use HMAC+SHA256 instead of ed25519 due to the fact that it's more standard and mostly equivalent in other ways for a "secret key hashing" use case. This is for when don't need a public key setup to allow others to verify the identity of the hasher, just for us to verify that we created the message.
func NewHMACKey ¶
func NewHMACKey() HMACKey
NewHMACKey creates a new cryptographically random HMAC key with HMACKeySize bytes.
You typically will want to store the output of this (the generated key) and use it repeatedly, hashing messages that you send out and checking validity when returned to you.