| 1 |
package openpgp |
| 2 |
|
| 3 |
import ( |
| 4 |
"crypto" |
| 5 |
|
| 6 |
"github.com/ProtonMail/go-crypto/openpgp/internal/algorithm" |
| 7 |
) |
| 8 |
|
| 9 |
// HashIdToHash returns a crypto.Hash which corresponds to the given OpenPGP |
| 10 |
// hash id. |
| 11 |
func HashIdToHash(id byte) (h crypto.Hash, ok bool) { |
| 12 |
return algorithm.HashIdToHash(id) |
| 13 |
} |
| 14 |
|
| 15 |
// HashIdToString returns the name of the hash function corresponding to the |
| 16 |
// given OpenPGP hash id. |
| 17 |
func HashIdToString(id byte) (name string, ok bool) { |
| 18 |
return algorithm.HashIdToString(id) |
| 19 |
} |
| 20 |
|
| 21 |
// HashToHashId returns an OpenPGP hash id which corresponds the given Hash. |
| 22 |
func HashToHashId(h crypto.Hash) (id byte, ok bool) { |
| 23 |
return algorithm.HashToHashId(h) |
| 24 |
} |