aboutsummaryrefslogtreecommitdiff
path: root/object/id/algorithm_parse.go
blob: 63db32dc4897b9bfb7e9e16dafc5f0017e18fe1c (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package id

// ParseAlgorithm parses a canonical algorithm name (e.g. "sha1", "sha256").
func ParseAlgorithm(s string) (Algorithm, bool) {
	algo, ok := algorithmByName[s]

	return algo, ok
}

// ParseSignatureHeaderName parses one canonical signature header name
// such as "gpgsig" or "gpgsig-sha256" to its respective algorithm.
func ParseSignatureHeaderName(s string) (Algorithm, bool) {
	algo, ok := algorithmBySignatureHeaderName[s]

	return algo, ok
}