nearlyfreespeech: fix salt

This commit is contained in:
Fernandez Ludovic 2023-08-21 00:25:40 +02:00
parent a423bb7411
commit a7befed6e8

View file

@ -125,9 +125,11 @@ func (c Signer) Sign(uri string, body, login, apiKey string) string {
// Workaround for https://golang.org/issue/58605
uri = "/" + strings.TrimLeft(uri, "/")
hashInput := fmt.Sprintf("%s;%s;%s;%s;%s;%02x", login, timestamp, c.saltShaker(), apiKey, uri, bodyHash)
salt := c.saltShaker()
return fmt.Sprintf("%s;%s;%s;%02x", login, timestamp, c.saltShaker(), sha1.Sum([]byte(hashInput)))
hashInput := fmt.Sprintf("%s;%s;%s;%s;%s;%02x", login, timestamp, salt, apiKey, uri, bodyHash)
return fmt.Sprintf("%s;%s;%s;%02x", login, timestamp, salt, sha1.Sum([]byte(hashInput)))
}
func getRandomSalt() []byte {