https://github.com/mcaimi/go-hmac
Simple HMAC library written in Go
https://github.com/mcaimi/go-hmac
Last synced: 3 months ago
JSON representation
Simple HMAC library written in Go
- Host: GitHub
- URL: https://github.com/mcaimi/go-hmac
- Owner: mcaimi
- License: gpl-3.0
- Created: 2023-03-13T09:50:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-11T16:52:03.000Z (over 2 years ago)
- Last Synced: 2025-03-06T10:22:14.577Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple HMAC Library written in Go
This is a simple HMAC library that implements the HMAC algorithm described in RFC2104.
Currently supports the generation of HMAC digests using MD5, SHA-1, SHA-256 and SHA-512 hashing primitives.
## Usage
Simply import the library and use the preferred hashing function:
```Go
package main
import (
"fmt"
"github.com/mcaimi/go-hmac/rfc2104"
)
const (
KEY = "my-secret-key"
MSG = "plaintext"
)
func main() {
var digest []byte
digest = rfc2104.Hmac([]byte(KEY), []byte(MSG), "sha1");
fmt.Printf("%x\n", digest);
}
```