Utilise a new field to send justifications instead of too complex guessing crap

This commit is contained in:
nemunaire 2018-11-28 07:39:50 +01:00
commit d40922629b
6 changed files with 69 additions and 24 deletions

View file

@ -52,6 +52,12 @@ func (e Exercice) GetFlags() ([]Flag, error) {
}
}
// GetFlagByLabel returns a flag matching the given label.
func (e Exercice) GetFlagByLabel(label string) (k Flag, err error) {
err = DBQueryRow("SELECT id_flag, id_exercice, type, help, ignorecase, validator_regexp, cksum FROM exercice_flags WHERE type = ? AND id_exercice = ?", label, e.Id).Scan(&k.Id, &k.IdExercice, &k.Label, &k.Help, &k.IgnoreCase, &k.ValidatorRegexp, &k.Checksum)
return
}
// getHashedFlag calculates the expected checksum for the given raw_value.
func getHashedFlag(raw_value []byte) [blake2b.Size]byte {
hash := blake2b.Sum512(raw_value)