From f8e17de9da7c78545e26ce24e67bd6bdb1fc93ed Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 30 Sep 2023 16:04:43 +0200 Subject: [PATCH] Rename to chacha20_ --- nip44.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nip44.go b/nip44.go index 62e7334..1953f34 100644 --- a/nip44.go +++ b/nip44.go @@ -59,7 +59,7 @@ func Encrypt(key []byte, plaintext string, options *EncryptOptions) (string, err if padded, err = pad(plaintext); err != nil { return "", err } - if ciphertext, err = chacha20Encrypt(enc, nonce, []byte(padded)); err != nil { + if ciphertext, err = chacha20_(enc, nonce, []byte(padded)); err != nil { return "", err } hmac_ = sha256Hmac(auth, ciphertext) @@ -103,7 +103,7 @@ func Decrypt(key []byte, ciphertext string) (string, error) { if !bytes.Equal(hmac_, sha256Hmac(auth, ciphertext_)) { return "", errors.New("invalid hmac") } - if padded, err = chacha20Encrypt(enc, nonce, ciphertext_); err != nil { + if padded, err = chacha20_(enc, nonce, ciphertext_); err != nil { return "", err } unpaddedLen = binary.BigEndian.Uint16(padded[0:2]) @@ -114,7 +114,7 @@ func Decrypt(key []byte, ciphertext string) (string, error) { return string(unpadded), nil } -func chacha20Encrypt(key []byte, nonce []byte, message []byte) ([]byte, error) { +func chacha20_(key []byte, nonce []byte, message []byte) ([]byte, error) { var ( cipher *chacha20.Cipher dst = make([]byte, len(message))