Replace blake2b by sha512 (as it is not yet available on alpine

This commit is contained in:
nemunaire 2018-02-21 01:51:06 +01:00 committed by Pierre-Olivier Mercier
commit 6df70342af
4 changed files with 7 additions and 12 deletions

View file

@ -2,6 +2,7 @@ package main
import (
"crypto/hmac"
"crypto/sha512"
"encoding/hex"
"encoding/json"
"errors"
@ -13,7 +14,6 @@ import (
"time"
"github.com/julienschmidt/httprouter"
"golang.org/x/crypto/blake2b"
)
const IPgwDMZ = "172.23.200.1"
@ -129,7 +129,7 @@ func challengeDisk(s *Student, t *givenToken, chid int) error {
return err
}
expectedToken := blake2b.Sum512([]byte(pkey[n1:n2]))
expectedToken := sha512.Sum512([]byte(pkey[n1:n2]))
if ! hmac.Equal(expectedToken[:], sum) {
return errors.New("This is not the expected token.")