refactor: migrate dlcache to struct

This commit is contained in:
2025-01-14 12:59:00 +03:00
parent eeb25c239b
commit 6bc6bfdcd9
4 changed files with 83 additions and 30 deletions

16
internal/dlcache/utils.go Normal file
View 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
}