photoprism/pkg/checksum/charset.go
Michael Mayer 149f5e5731 CI: Apply Go linter recommendations to remaining "pkg/..." code #5330
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-11-22 16:14:43 +01:00

20 lines
743 B
Go

package checksum
const (
// CharsetBase10 contains digits for base10 encoding.
CharsetBase10 = "0123456789"
// CharsetBase36 contains lowercase alphanumerics for base36.
CharsetBase36 = "abcdefghijklmnopqrstuvwxyz0123456789"
// CharsetBase62 contains mixed-case alphanumerics for base62.
CharsetBase62 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
)
// Char returns a simple checksum byte based on Crc32 and the 62 characters specified in CharsetBase62.
func Char(data []byte) byte {
return CharsetBase62[Crc32(data)%62]
}
// Base36 returns a simple checksum byte based on Crc32 and the 36 lower-case characters specified in CharsetBase36.
func Base36(data []byte) byte {
return CharsetBase36[Crc32(data)%36]
}