2025-10-10 07:13:36 -07: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]
}