Skip to content
Snippets Groups Projects
Select Git revision
  • 1ec85e30aeacf76a2cf2bcf3eb3f836ff4f7e051
  • main default protected
  • 1-mage-run-does-not-stop-containers
  • v0.26.0
  • v0.25.0
  • v0.24.0
  • v0.23.0
  • v0.22.0
  • v0.21.0
  • v0.20.0
  • v0.19.0
  • v0.18.0
  • v0.17.0
  • v0.16.0
  • v0.15.0
  • v0.14.0
  • v0.13.0
  • v0.12.0
  • v0.11.0
  • v0.10.0
  • v0.9.0
  • v0.8.0
  • v0.7.0
23 results

git.go

Blame
  • encryption.go 430 B
    package encryption
    
    import (
    	"crypto/hmac"
    	"crypto/md5"
    	"crypto/sha256"
    	"encoding/base64"
    	"fmt"
    )
    
    func Hash(input string, key string) string {
    	keyBytes := []byte(key)
    	h := hmac.New(sha256.New, keyBytes)
    	h.Write([]byte(input))
    	return base64.StdEncoding.EncodeToString(h.Sum(nil))
    }
    
    func Md5HashString(bytesToHash []byte) string {
    	hash := md5.Sum(bytesToHash)
    	hashString := fmt.Sprintf("%X", hash)
    	return hashString
    }