refactor: migrate dlcache to struct
This commit is contained in:
16
internal/dlcache/utils.go
Normal file
16
internal/dlcache/utils.go
Normal file
@ -0,0 +1,16 @@
|
||||
package dlcache
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
)
|
||||
|
||||
func hashID(id string) (string, error) {
|
||||
h := sha1.New()
|
||||
_, err := io.WriteString(h, id)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(h.Sum(nil)), nil
|
||||
}
|
Reference in New Issue
Block a user