mirror of
https://github.com/logos-messaging/noise.git
synced 2026-01-05 23:53:08 +00:00
Hide cipher functions from docs
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
This commit is contained in:
parent
9d237a2bfc
commit
f63da97e27
@ -136,41 +136,39 @@ func (c cipherFn) Cipher(k [32]byte) Cipher { return c.fn(k) }
|
|||||||
func (c cipherFn) CipherName() string { return c.name }
|
func (c cipherFn) CipherName() string { return c.name }
|
||||||
|
|
||||||
// CipherAESGCM is the AES256-GCM AEAD cipher.
|
// CipherAESGCM is the AES256-GCM AEAD cipher.
|
||||||
var CipherAESGCM CipherFunc = cipherFn{
|
var CipherAESGCM CipherFunc = cipherFn{cipherAESGCM, "AESGCM"}
|
||||||
func(k [32]byte) Cipher {
|
|
||||||
c, err := aes.NewCipher(k[:])
|
func cipherAESGCM(k [32]byte) Cipher {
|
||||||
if err != nil {
|
c, err := aes.NewCipher(k[:])
|
||||||
panic(err)
|
if err != nil {
|
||||||
}
|
panic(err)
|
||||||
gcm, err := cipher.NewGCM(c)
|
}
|
||||||
if err != nil {
|
gcm, err := cipher.NewGCM(c)
|
||||||
panic(err)
|
if err != nil {
|
||||||
}
|
panic(err)
|
||||||
return aeadCipher{
|
}
|
||||||
gcm,
|
return aeadCipher{
|
||||||
func(n uint64) []byte {
|
gcm,
|
||||||
var nonce [12]byte
|
func(n uint64) []byte {
|
||||||
binary.BigEndian.PutUint64(nonce[4:], n)
|
var nonce [12]byte
|
||||||
return nonce[:]
|
binary.BigEndian.PutUint64(nonce[4:], n)
|
||||||
},
|
return nonce[:]
|
||||||
}
|
},
|
||||||
},
|
}
|
||||||
"AESGCM",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CipherChaChaPoly is the ChaCha20-Poly1305 AEAD cipher construction.
|
// CipherChaChaPoly is the ChaCha20-Poly1305 AEAD cipher construction.
|
||||||
var CipherChaChaPoly CipherFunc = cipherFn{
|
var CipherChaChaPoly CipherFunc = cipherFn{cipherChaChaPoly, "ChaChaPoly"}
|
||||||
func(k [32]byte) Cipher {
|
|
||||||
return aeadCipher{
|
func cipherChaChaPoly(k [32]byte) Cipher {
|
||||||
chap.NewCipher(&k),
|
return aeadCipher{
|
||||||
func(n uint64) []byte {
|
chap.NewCipher(&k),
|
||||||
var nonce [12]byte
|
func(n uint64) []byte {
|
||||||
binary.LittleEndian.PutUint64(nonce[4:], n)
|
var nonce [12]byte
|
||||||
return nonce[:]
|
binary.LittleEndian.PutUint64(nonce[4:], n)
|
||||||
},
|
return nonce[:]
|
||||||
}
|
},
|
||||||
},
|
}
|
||||||
"ChaChaPoly",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type aeadCipher struct {
|
type aeadCipher struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user