mirror of
https://github.com/packwiz/packwiz.git
synced 2025-11-19 01:24:32 +01:00
Implement pack importing/exporting for downloaded Curseforge packs
Abstract out hash implementations Implement file saving/downloading
This commit is contained in:
23
core/hash.go
Normal file
23
core/hash.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/sha256"
|
||||
"crypto/sha512"
|
||||
"errors"
|
||||
"hash"
|
||||
)
|
||||
|
||||
// GetHashImpl gets an implementation of hash.Hash for the given hash type string
|
||||
func GetHashImpl(hashType string) (hash.Hash, error) {
|
||||
switch hashType {
|
||||
case "sha256":
|
||||
return sha256.New(), nil
|
||||
case "sha512":
|
||||
return sha512.New(), nil
|
||||
case "md5":
|
||||
return md5.New(), nil
|
||||
}
|
||||
// TODO: implement murmur2
|
||||
return nil, errors.New("hash implementation not found")
|
||||
}
|
||||
Reference in New Issue
Block a user