Skip to content

Commit

Permalink
Improve const naming
Browse files Browse the repository at this point in the history
  • Loading branch information
tobischo committed Mar 27, 2024
1 parent bbda626 commit 0d066e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ type Stream interface {
}

const (
encrypterManagerChaCha20 = 12
encrypterManagerAES = 16
ivLengthChaCha20 = 12
ivLengthAES = 16
)

// NewEncrypterManager initialize a new EncrypterManager
func NewEncrypterManager(key []byte, iv []byte) (*EncrypterManager, error) {
switch len(iv) {
case encrypterManagerChaCha20:
case ivLengthChaCha20:
// ChaCha20
encrypter, err := crypto.NewChaChaEncrypter(key, iv)
if err != nil {
Expand All @@ -54,7 +54,7 @@ func NewEncrypterManager(key []byte, iv []byte) (*EncrypterManager, error) {
return &EncrypterManager{
Encrypter: encrypter,
}, nil
case encrypterManagerAES:
case ivLengthAES:
// AES
encrypter, err := crypto.NewAESEncrypter(key, iv)
if err != nil {
Expand Down

0 comments on commit 0d066e4

Please sign in to comment.