Skip to content

RFC 4543 Galois Message Authentication Code (GMAC) (NIST SP800-38D)

License

Notifications You must be signed in to change notification settings

pedroalbanese/gmac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

GMAC

ISC License GoDoc Go Report Card

RFC 4543 Galois Message Authentication Code (GMAC) (NIST SP800-38D)

"GMAC" stands for "Galois Message Authentication Code." It is a cryptographic authentication code that provides integrity and authenticity assurances for a given message or data. GMAC is specifically associated with the GCM (Galois/Counter Mode) mode of operation for block ciphers. It's used in authenticated encryption, ensuring that the data remains unaltered and authentic while providing confidentiality through encryption.

Usage

package main

import (
	"crypto/aes"
	"encoding/hex"
	"fmt"
	"log"

	"github.com/pedroalbanese/gmac"
)

func main() {
	// Example using AES block cipher
	key, _ := hex.DecodeString("00000000000000000000000000000000")
	nonce, _ := hex.DecodeString("00000000000000000000000000000000")
	message := []byte("Yoda said, do or do not. There is no try.")

	block, _ := aes.NewCipher(key)
	gmac, err := gmac.New(block, nonce, message)
	if err != nil {
		log.Fatal(err)
	}

	// Print out GMAC
	fmt.Printf("GMAC: %x\n", gmac)
}

Result: GMAC: e7ee2c63b4dc328eed4a86b3fb3490af

Reference

https://www.cryptopp.com/wiki/GMAC

License

This project is licensed under the ISC License.

Copyright (c) 2020-2023 Pedro F. Albanese - ALBANESE Research Lab.

About

RFC 4543 Galois Message Authentication Code (GMAC) (NIST SP800-38D)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages