mirror of
https://github.com/vbatts/dedupe-linker.git
synced 2024-12-28 09:36:30 +00:00
cryptomap: golint
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
267c961503
commit
7ea5cd6bc4
1 changed files with 7 additions and 2 deletions
|
@ -2,19 +2,24 @@ package cryptomap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto"
|
"crypto"
|
||||||
|
"log"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
// Importing all the currently supported hashes
|
||||||
_ "crypto/md5"
|
_ "crypto/md5"
|
||||||
_ "crypto/sha1"
|
_ "crypto/sha1"
|
||||||
_ "crypto/sha256"
|
_ "crypto/sha256"
|
||||||
_ "crypto/sha512"
|
_ "crypto/sha512"
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var knownCiphers = map[string]crypto.Hash{
|
var knownCiphers = map[string]crypto.Hash{
|
||||||
"md5": crypto.MD5,
|
"md5": crypto.MD5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DetermineHash takes a generic string, like "sha1" and returns the
|
||||||
|
// corresponding crypto.Hash
|
||||||
func DetermineHash(str string) (h crypto.Hash) {
|
func DetermineHash(str string) (h crypto.Hash) {
|
||||||
|
// TODO make these strings discoverable, like a public variable
|
||||||
switch strings.ToLower(str) {
|
switch strings.ToLower(str) {
|
||||||
case "md5":
|
case "md5":
|
||||||
h = crypto.MD5
|
h = crypto.MD5
|
||||||
|
|
Loading…
Reference in a new issue