code.gitea.io/gitea@v1.22.3/models/migrations/base/hash.go (about) 1 // Copyright 2022 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package base 5 6 import ( 7 "crypto/sha256" 8 "encoding/hex" 9 10 "golang.org/x/crypto/pbkdf2" 11 ) 12 13 func HashToken(token, salt string) string { 14 tempHash := pbkdf2.Key([]byte(token), []byte(salt), 10000, 50, sha256.New) 15 return hex.EncodeToString(tempHash) 16 }