2022-06-24 18:56:06 +02:00
|
|
|
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.
|
2022-06-28 13:49:35 +02:00
|
|
|
QuizHashes(quiz *client.Quiz) []string
|
2022-06-24 18:56:06 +02:00
|
|
|
|
|
|
|
// QuestionHash returns an hash calculated from a field of
|
|
|
|
// Question struct.
|
2022-06-28 13:49:35 +02:00
|
|
|
QuestionHash(question *client.Question) string
|
2022-06-24 18:56:06 +02:00
|
|
|
|
|
|
|
// AnswerHash returns an hash calculated from a field of
|
|
|
|
// Answer struct.
|
2022-06-28 13:49:35 +02:00
|
|
|
AnswerHash(answer *client.Answer) string
|
2022-06-24 18:56:06 +02:00
|
|
|
|
|
|
|
// Calculate calculates a checksum from all the given hashes.
|
|
|
|
Calculate(hashes []string) string
|
|
|
|
}
|