2025-09-27 10:17:16 +08:00

15 lines
246 B
Go

package tool
import (
"crypto/sha1"
"fmt"
)
func GenerateShortID(privateKey string) string {
hash := sha1.New()
hash.Write([]byte(privateKey))
hashValue := hash.Sum(nil)
hashString := fmt.Sprintf("%x", hashValue)
return hashString[:8]
}