From f2c6b89932713797b56a4c7809a1fd7702aa05e5 Mon Sep 17 00:00:00 2001 From: AppleTheGolden Date: Wed, 13 Jan 2021 20:00:04 +0100 Subject: [PATCH] Lowercase hashes before comparing them (#10) --- .gitignore | 3 ++- core/hash.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c2d94e6..a848dc3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Binaries for programs and plugins +/packwiz *.exe *.exe~ *.dll @@ -12,4 +13,4 @@ *.out # I use GoLand now -.idea/ \ No newline at end of file +.idea/ diff --git a/core/hash.go b/core/hash.go index ef05119..62487a8 100644 --- a/core/hash.go +++ b/core/hash.go @@ -4,13 +4,14 @@ import ( "crypto/md5" "crypto/sha256" "crypto/sha512" + "strings" "errors" "hash" ) // GetHashImpl gets an implementation of hash.Hash for the given hash type string func GetHashImpl(hashType string) (hash.Hash, error) { - switch hashType { + switch strings.ToLower(hashType) { case "sha256": return sha256.New(), nil case "sha512":