This repository has been archived on 2024-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
adlin/hmac-generator/main.go

23 lines
364 B
Go

package main
import (
"crypto/hmac"
"crypto/sha512"
"encoding/base64"
"fmt"
"os"
"time"
)
func main() {
sharedSecret := "adelina"
if len(os.Args) > 1 {
sharedSecret = os.Args[1]
}
h := hmac.New(sha512.New, []byte(sharedSecret))
h.Write([]byte(fmt.Sprintf("%d", time.Now().Unix()/10)))
fmt.Println(base64.StdEncoding.EncodeToString(h.Sum(nil)))
}