Priority/backend.old/hash.go

13 lines
166 B
Go
Raw Normal View History

2023-12-05 13:48:13 +01:00
package main
import (
"crypto/sha256"
"fmt"
)
func CalcId(str string, len int) string {
id := sha256.Sum256([]byte(str))
return fmt.Sprintf("%X", id)[0:len]
}