code.gitea.io/gitea@v1.21.7/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  	"encoding/hex"
     8  
     9  	"github.com/minio/sha256-simd"
    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  }