Ejemplo n.º 1
0
// OneTimeAuthVerify verifies a message authentication code (MAC) for a given message and key.
//
// Returns: 0 if the MAC authenticates the message, -1 if not.
func OneTimeAuthVerify(mac, message, key []byte) int {
	support.CheckSize(mac, OneTimeAuthBytes(), "MAC")
	support.CheckSize(key, OneTimeAuthKeyBytes(), "key")

	return int(C.crypto_onetimeauth_verify(
		(*C.uchar)(&mac[0]),
		(*C.uchar)(&message[0]), (C.ulonglong)(len(message)),
		(*C.uchar)(&key[0])))
}
Ejemplo n.º 2
0
func OneTimeAuthVerify(auth []byte, message []byte, key []byte) bool {
	return C.crypto_onetimeauth_verify(array(auth), array(message), C.ulonglong(len(message)), array(key)) == 0
}