tgf / internal /utils /hashing.go
Mohammad Shahid
added user managment
aa300d8
raw
history blame contribute delete
503 Bytes
package utils
import (
"TelegramCloud/tgf/config"
"TelegramCloud/tgf/internal/types"
)
func PackFile(fileName string, fileSize int64, mimeType string, fileID int64) string {
return (&types.HashableFileStruct{FileName: fileName, FileSize: fileSize, MimeType: mimeType, FileID: fileID}).Pack()
}
func GetShortHash(fullHash string) string {
return fullHash[:config.ValueOf.HashLength]
}
func CheckHash(inputHash string, expectedHash string) bool {
return inputHash == GetShortHash(expectedHash)
}