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
}