diff options
author | Saumit Dinesan <justsaumit@protonmail.com> | 2023-11-28 15:17:18 +0530 |
---|---|---|
committer | Saumit Dinesan <justsaumit@protonmail.com> | 2023-11-28 15:17:18 +0530 |
commit | 82d5136c1b03efbb99931884dd75ab1160689ceb (patch) | |
tree | 3095f344055c4ad54a8238599839fa0088054fbd /hasher/blake2-hash_generator.go | |
parent | a3ead3d67520704eda55a74841b00d5766728fab (diff) |
Refactoring project - Introducing handlers,models and utils- Updating previous hasher and idgen func + formatting
Diffstat (limited to 'hasher/blake2-hash_generator.go')
-rw-r--r-- | hasher/blake2-hash_generator.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/hasher/blake2-hash_generator.go b/hasher/blake2-hash_generator.go deleted file mode 100644 index e71a736..0000000 --- a/hasher/blake2-hash_generator.go +++ /dev/null @@ -1,30 +0,0 @@ -package hasher - -import ( - "fmt" - "golang.org/x/crypto/blake2b" - "io" - "os" -) - -func CalculateBLAKE2Hash(filePath string) (string, error) { - file, err := os.Open(filePath) - if err != nil { - return "", err - } - defer file.Close() - - hash, err := blake2b.New256(nil) - if err != nil { - return "", err - } - - _, err = io.Copy(hash, file) - if err != nil { - return "", err - } - - hashBytes := hash.Sum(nil) - hashString := fmt.Sprintf("%x", hashBytes) - return hashString, nil -} |