mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
added hopscotch cipher
This commit is contained in:
parent
db8697aa35
commit
129dce4b08
6 changed files with 16 additions and 2 deletions
|
@ -21,6 +21,7 @@ import (
|
|||
"log"
|
||||
|
||||
"blitter.com/go/cryptmt"
|
||||
"blitter.com/go/hopscotch"
|
||||
"github.com/aead/chacha20/chacha"
|
||||
"golang.org/x/crypto/blowfish"
|
||||
"golang.org/x/crypto/twofish"
|
||||
|
@ -105,6 +106,9 @@ func (hc *Conn) getStream(keymat []byte) (rc cipher.Stream, mc hash.Hash, err er
|
|||
case CAlgCryptMT1:
|
||||
rc = cryptmt.New(nil, nil, keymat)
|
||||
log.Printf("[cipher CRYPTMT1 (%d)]\n", copts)
|
||||
case CAlgHopscotch:
|
||||
rc = hopscotch.New(nil, nil, 4, keymat)
|
||||
log.Printf("[cipher HOPSCOTCH (%d)]\n", copts)
|
||||
case CAlgChaCha20_12:
|
||||
keymat = expandKeyMat(keymat, chacha.KeySize)
|
||||
key = keymat[0:chacha.KeySize]
|
||||
|
|
|
@ -107,6 +107,7 @@ const (
|
|||
CAlgBlowfish64 // golang.org/x/crypto/blowfish
|
||||
CAlgCryptMT1 //cryptmt using mtwist64
|
||||
CAlgChaCha20_12
|
||||
CAlgHopscotch
|
||||
CAlgNoneDisallowed
|
||||
)
|
||||
|
||||
|
|
|
@ -155,6 +155,8 @@ func (c *CSCipherAlg) String() string {
|
|||
return "C_BLOWFISH_64"
|
||||
case CAlgCryptMT1:
|
||||
return "C_CRYPTMT1"
|
||||
case CAlgHopscotch:
|
||||
return "C_HOPSCOTCH"
|
||||
case CAlgChaCha20_12:
|
||||
return "C_CHACHA20_12"
|
||||
default:
|
||||
|
@ -320,7 +322,7 @@ func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
|
|||
//
|
||||
// Session (symmetric) crypto
|
||||
//
|
||||
// C_AES_256 C_TWOFISH_128 C_BLOWFISH_128 C_CRYPTMT1 C_CHACHA20_12
|
||||
// C_AES_256 C_TWOFISH_128 C_BLOWFISH_128 C_CRYPTMT1 C_CHACHA20_12 C_HOPSCOTCH
|
||||
//
|
||||
// Session HMACs
|
||||
//
|
||||
|
@ -344,6 +346,10 @@ func (hc *Conn) applyConnExtensions(extensions ...string) {
|
|||
log.Println("[extension arg = C_CRYPTMT1]")
|
||||
hc.cipheropts &= (0xFFFFFF00)
|
||||
hc.cipheropts |= CAlgCryptMT1
|
||||
case "C_HOPSCOTCH":
|
||||
log.Println("[extension arg = C_HOPSCOTCH]")
|
||||
hc.cipheropts &= (0xFFFFFF00)
|
||||
hc.cipheropts |= CAlgHopscotch
|
||||
case "C_CHACHA20_12":
|
||||
log.Println("[extension arg = C_CHACHA20_12]")
|
||||
hc.cipheropts &= (0xFFFFFF00)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue