mirror of
https://github.com/packwiz/packwiz.git
synced 2025-10-25 01:54:31 +02:00
Lowercase hashes before comparing them (#10)
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
# Binaries for programs and plugins
|
# Binaries for programs and plugins
|
||||||
|
/packwiz
|
||||||
*.exe
|
*.exe
|
||||||
*.exe~
|
*.exe~
|
||||||
*.dll
|
*.dll
|
||||||
@@ -12,4 +13,4 @@
|
|||||||
*.out
|
*.out
|
||||||
|
|
||||||
# I use GoLand now
|
# I use GoLand now
|
||||||
.idea/
|
.idea/
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import (
|
|||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"crypto/sha512"
|
"crypto/sha512"
|
||||||
|
"strings"
|
||||||
"errors"
|
"errors"
|
||||||
"hash"
|
"hash"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetHashImpl gets an implementation of hash.Hash for the given hash type string
|
// GetHashImpl gets an implementation of hash.Hash for the given hash type string
|
||||||
func GetHashImpl(hashType string) (hash.Hash, error) {
|
func GetHashImpl(hashType string) (hash.Hash, error) {
|
||||||
switch hashType {
|
switch strings.ToLower(hashType) {
|
||||||
case "sha256":
|
case "sha256":
|
||||||
return sha256.New(), nil
|
return sha256.New(), nil
|
||||||
case "sha512":
|
case "sha512":
|
||||||
|
|||||||
Reference in New Issue
Block a user