2
0
mirror of https://github.com/namecoin/ncdns synced 2024-11-16 00:13:01 +00:00

Use pointer receiver on DehydratedCertificate methods

Improves speed by avoiding copy operations.
This commit is contained in:
Jeremy Rand 2020-11-22 12:15:33 +00:00
parent 647f05f049
commit d28a01dcd5
No known key found for this signature in database
GPG Key ID: FD7550C2EB800711

View File

@ -31,7 +31,7 @@ type DehydratedCertificate struct {
// SerialNumber calculates the certificate serial number according to the
// Dehydrated TLS Certificates specification.
func (dehydrated DehydratedCertificate) SerialNumber(name string) ([]byte, error) {
func (dehydrated *DehydratedCertificate) SerialNumber(name string) ([]byte, error) {
nameHash := sha256.Sum256([]byte(name))
@ -77,7 +77,7 @@ func (dehydrated DehydratedCertificate) SerialNumber(name string) ([]byte, error
return serialHash.Sum(nil)[0:19], nil
}
func (dehydrated DehydratedCertificate) String() string {
func (dehydrated *DehydratedCertificate) String() string {
output := []interface{}{1, dehydrated.PubkeyB64, dehydrated.NotBeforeScaled, dehydrated.NotAfterScaled, dehydrated.SignatureAlgorithm, dehydrated.SignatureB64}
binOutput, _ := json.Marshal(output)
return string(binOutput)