init: 1.0.0
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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]
|
||||
}
|
||||
Reference in New Issue
Block a user