maps-service/pkg/model/script.go
Quaternions 6bab1e1b6b
All checks were successful
continuous-integration/drone/push Build is passing
submissions: centralize hashing and formatting
2024-12-17 15:57:39 -08:00

27 lines
478 B
Go

package model
import (
"fmt"
"time"
"github.com/dchest/siphash"
)
func HashSource(source string) uint64{
return siphash.Hash(0, 0, []byte(source))
}
func HashFormat(hash uint64) string{
return fmt.Sprintf("%016x", hash)
}
type Script struct {
ID int64 `gorm:"primaryKey"`
Name string
Hash uint64
Source string
SubmissionID int64 // which submission did this script first appear in
CreatedAt time.Time
UpdatedAt time.Time
}