Skip to content

Commit 6f10f22

Browse files
committed
also output sha256 digest when generating certificate
1 parent ebe0199 commit 6f10f22

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/generator/generator.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package generator
44
import (
55
"crypto/md5"
66
"crypto/sha1"
7+
"crypto/sha256"
78
"crypto/x509"
89
"encoding/json"
910
"encoding/pem"
@@ -35,6 +36,7 @@ specifically, section 10.2.3 ("Information Requirements").`
3536
type Sum struct {
3637
MD5 string `json:"md5"`
3738
SHA1 string `json:"sha-1"`
39+
SHA256 string `json:"sha-256"`
3840
}
3941

4042
// Validator is a type of function that contains the logic for validating
@@ -97,8 +99,10 @@ func computeSum(in []byte) (sum Sum, err error) {
9799

98100
md5Sum := md5.Sum(data)
99101
sha1Sum := sha1.Sum(data)
102+
sha256Sum := sha256.Sum256(data)
100103
sum.MD5 = fmt.Sprintf("%X", md5Sum[:])
101104
sum.SHA1 = fmt.Sprintf("%X", sha1Sum[:])
105+
sum.SHA256 = fmt.Sprintf("%X", sha256Sum[:])
102106
return
103107
}
104108

0 commit comments

Comments
 (0)