hasher.go 709 B

1234567891011121314151617181920212223242526
  1. package hasher
  2. import (
  3. "git.andreafazzi.eu/andrea/probo/client"
  4. )
  5. type HashFunc func(string) string
  6. type Hasher interface {
  7. // Hash returns a slice of hashes. The first one is an
  8. // hash calculated from the question using
  9. // QuestionHash. Following hashes are calculated from the
  10. // answers using AnswerHash.
  11. QuizHashes(quiz *client.Quiz) []string
  12. // QuestionHash returns an hash calculated from a field of
  13. // Question struct.
  14. QuestionHash(question *client.Question) string
  15. // AnswerHash returns an hash calculated from a field of
  16. // Answer struct.
  17. AnswerHash(answer *client.Answer) string
  18. // Calculate calculates a checksum from all the given hashes.
  19. Calculate(hashes []string) string
  20. }