mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 13:06:30 +02:00
Lowercase hashes before comparing them (#10)
This commit is contained in:
parent
b8887e6704
commit
f2c6b89932
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
# Binaries for programs and plugins
|
# Binaries for programs and plugins
|
||||||
|
/packwiz
|
||||||
*.exe
|
*.exe
|
||||||
*.exe~
|
*.exe~
|
||||||
*.dll
|
*.dll
|
||||||
|
@ -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":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user