From 82d5136c1b03efbb99931884dd75ab1160689ceb Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Tue, 28 Nov 2023 15:17:18 +0530 Subject: Refactoring project - Introducing handlers,models and utils- Updating previous hasher and idgen func + formatting --- hasher/blake2-hash_generator.go | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 hasher/blake2-hash_generator.go (limited to 'hasher') 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 -} -- cgit v1.2.3