Skip to content
Snippets Groups Projects
Commit a41b0b45 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Rewrite the sha sum to match our guidelines of never using a slice in calls to Sum.

parent ebf36d8c
No related branches found
No related tags found
No related merge requests found
...@@ -153,7 +153,9 @@ func (p *PrivateKey) FromBytes(data []byte) error { ...@@ -153,7 +153,9 @@ func (p *PrivateKey) FromBytes(data []byte) error {
// conversion as specified in https://www.rfc-editor.org/rfc/rfc8032#section-5.1.5 // conversion as specified in https://www.rfc-editor.org/rfc/rfc8032#section-5.1.5
func (p *PrivateKey) FromEdwards(privateKey ed25519.PrivateKey) { func (p *PrivateKey) FromEdwards(privateKey ed25519.PrivateKey) {
p.edwards = privateKey p.edwards = privateKey
dhBytes := sha512.Sum512(privateKey[:32]) hash := sha512.New()
hash.Write(privateKey[:32])
dhBytes := hash.Sum(nil)
dhBytes[0] &= 248 dhBytes[0] &= 248
dhBytes[31] &= 127 dhBytes[31] &= 127
dhBytes[31] |= 64 dhBytes[31] |= 64
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment