diff options
Diffstat (limited to 'hasher/blake2-hash_generator.go')
-rw-r--r-- | hasher/blake2-hash_generator.go | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/hasher/blake2-hash_generator.go b/hasher/blake2-hash_generator.go index 4d85a58..e71a736 100644 --- a/hasher/blake2-hash_generator.go +++ b/hasher/blake2-hash_generator.go @@ -1,30 +1,30 @@ package hasher import ( - "fmt" - "golang.org/x/crypto/blake2b" - "io" - "os" + "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() + file, err := os.Open(filePath) + if err != nil { + return "", err + } + defer file.Close() - hash, err := blake2b.New256(nil) - if err != nil { - return "", err - } + hash, err := blake2b.New256(nil) + if err != nil { + return "", err + } - _, err = io.Copy(hash, file) - 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 + hashBytes := hash.Sum(nil) + hashString := fmt.Sprintf("%x", hashBytes) + return hashString, nil } |