github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/util/hash.go (about) 1 // Copyright 2023 The GitBundle Inc. All rights reserved. 2 // Copyright 2017 The Gitea Authors. All rights reserved. 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file. 5 6 package util 7 8 import ( 9 "crypto/sha256" 10 "fmt" 11 12 "github.com/xdg-go/pbkdf2" 13 ) 14 15 func GenerateHashString(token, salt string) string { 16 tempHash := pbkdf2.Key([]byte(token), []byte(salt), 10000, 50, sha256.New) 17 return fmt.Sprintf("%x", tempHash) 18 }