probo/hasher/hasher.go
2022-06-28 13:49:35 +02:00

26 lines
709 B
Go

package hasher
import (
"git.andreafazzi.eu/andrea/probo/client"
)
type HashFunc func(string) string
type Hasher interface {
// Hash returns a slice of hashes. The first one is an
// hash calculated from the question using
// QuestionHash. Following hashes are calculated from the
// answers using AnswerHash.
QuizHashes(quiz *client.Quiz) []string
// QuestionHash returns an hash calculated from a field of
// Question struct.
QuestionHash(question *client.Question) string
// AnswerHash returns an hash calculated from a field of
// Answer struct.
AnswerHash(answer *client.Answer) string
// Calculate calculates a checksum from all the given hashes.
Calculate(hashes []string) string
}