[nonworking] Groestl hash addition

This commit is contained in:
Russ Magee 2021-11-22 09:26:42 -08:00
parent 02e379e50d
commit 56f62709ad
6 changed files with 18 additions and 2 deletions

View file

@ -31,6 +31,7 @@ import (
// on this...)
_ "crypto/sha256"
_ "crypto/sha512"
groestl "groestl/pkg/groestl"
)
// Expand keymat, if necessary, to a minimum of 2x(blocksize).
@ -144,6 +145,9 @@ func (hc *Conn) getStream(keymat []byte) (rc cipher.Stream, mc hash.Hash, err er
if !halg.Available() {
log.Fatal("hash not available!")
}
case HmacGroestl256:
log.Printf("[hash HmacGroestl256 (%d)]\n", hopts)
mc = groestl.New256()
default:
log.Printf("[invalid hmac (%d)]\n", hopts)
fmt.Printf("DOOFUS SET A VALID HMAC ALG (%d)\n", hopts)

View file

@ -118,6 +118,7 @@ type CSCipherAlg uint32
const (
HmacSHA256 = iota
HmacSHA512
HmacGroestl256
HmacNoneDisallowed
)

View file

@ -174,6 +174,8 @@ func (h *CSHmacAlg) String() string {
return "H_SHA256"
case HmacSHA512:
return "H_SHA512"
case HmacGroestl256:
return "H_GROESTL256"
default:
return "H_ERR_UNK"
}
@ -362,6 +364,10 @@ func (hc *Conn) applyConnExtensions(extensions ...string) {
log.Println("[extension arg = H_SHA512]")
hc.cipheropts &= (0xFFFF00FF)
hc.cipheropts |= (HmacSHA512 << 8)
case "H_GROESTL256":
log.Println("[extension arg = H_GROESTL256]")
hc.cipheropts &= (0xFFFF00FF)
hc.cipheropts |= (HmacGroestl256 << 8)
//default:
// log.Printf("[Dial ext \"%s\" ignored]\n", s)
}