From 9f501e70359d28c10bced95b27681ad593f4a3a9 Mon Sep 17 00:00:00 2001 From: euphoria-laxis Date: Wed, 13 Sep 2023 10:20:11 +0200 Subject: [PATCH] Rename files for better understanding of files content --- argon2/{crypto.go => argon2.go} | 21 +++++++++++++++++++++ argon2/{crypto_test.go => argon2_test.go} | 0 argon2/crypto_struct.go | 23 ----------------------- 3 files changed, 21 insertions(+), 23 deletions(-) rename argon2/{crypto.go => argon2.go} (83%) rename argon2/{crypto_test.go => argon2_test.go} (100%) delete mode 100644 argon2/crypto_struct.go diff --git a/argon2/crypto.go b/argon2/argon2.go similarity index 83% rename from argon2/crypto.go rename to argon2/argon2.go index e7a0840..54ef9d2 100644 --- a/argon2/crypto.go +++ b/argon2/argon2.go @@ -4,11 +4,32 @@ import ( "crypto/rand" "crypto/subtle" "encoding/base64" + "errors" "fmt" "golang.org/x/crypto/argon2" "strings" ) +type params struct { + memory uint32 + iterations uint32 + parallelism uint8 + saltLength uint32 + keyLength uint32 +} + +var ( + ErrInvalidHash = errors.New("the encoded hash is not in the correct format") + ErrIncompatibleVersion = errors.New("incompatible version of argon2") + p = ¶ms{ + memory: 64 * 1024, + iterations: 3, + parallelism: 2, + saltLength: 16, + keyLength: 32, + } +) + func generateRandomBytes(n uint32) ([]byte, error) { b := make([]byte, n) _, err := rand.Read(b) diff --git a/argon2/crypto_test.go b/argon2/argon2_test.go similarity index 100% rename from argon2/crypto_test.go rename to argon2/argon2_test.go diff --git a/argon2/crypto_struct.go b/argon2/crypto_struct.go deleted file mode 100644 index 771ebc7..0000000 --- a/argon2/crypto_struct.go +++ /dev/null @@ -1,23 +0,0 @@ -package argon2 - -import "errors" - -type params struct { - memory uint32 - iterations uint32 - parallelism uint8 - saltLength uint32 - keyLength uint32 -} - -var ( - ErrInvalidHash = errors.New("the encoded hash is not in the correct format") - ErrIncompatibleVersion = errors.New("incompatible version of argon2") - p = ¶ms{ - memory: 64 * 1024, - iterations: 3, - parallelism: 2, - saltLength: 16, - keyLength: 32, - } -)