dimanche 13 décembre 2020

Testing against HMAC creation

I am learning about HMAC and wrote this snippet on generating a MAC from a message. I was wondering what would be considered proper test cases for this little function I wrote.

I was told that I should never write my own security which is why I am simply using the libraries provided to me. However, this means that I don't quite know how to test my code and "trust" that my security just works

func GenerateMAC(message []byte, secret []byte) []byte {
    mac := hmac.New(sha256.New, secret)
    mac.Write(message)
    s := mac.Sum(nil)
    return s
}

Aucun commentaire:

Enregistrer un commentaire