aboutsummaryrefslogtreecommitdiff
path: root/pkg/utils/utils.go
blob: 50557233a1be22ab70dbe90d8172911f30380ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
package utils

import (
	"crypto/sha256"
	"fmt"
)

// Hash Adapted from: https://blog.8bitzen.com/posts/22-08-2019-how-to-hash-a-struct-in-go
func Hash(o interface{}) string {
	h := sha256.New()
	h.Write([]byte(fmt.Sprintf("%v", o)))
	return fmt.Sprintf("%x", h.Sum(nil))
}