Skip to content

Commit

Permalink
ext: Use SHA256 instead of SHA1 for fingerprinting
Browse files Browse the repository at this point in the history
To make static analysis tools happy.

The current use of SHA1 for fingerprinting is safe. However, there is very
little downside to switching to SHA256.
  • Loading branch information
Katee committed Oct 12, 2018
1 parent ddaf19b commit 8d5a013
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ext/vulnsrc/debian/debian.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package debian

import (
"crypto/sha1"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -67,7 +67,7 @@ func (u *updater) Update(datastore database.Datastore) (resp vulnsrc.UpdateRespo
return resp, err
}

// Get the SHA-1 of the latest update's JSON data
// Get the hash of the latest update's JSON data
latestHash, ok, err := tx.FindKeyValue(updaterFlag)
if err != nil {
return resp, err
Expand Down Expand Up @@ -119,9 +119,9 @@ func buildResponse(jsonReader io.Reader, latestKnownHash string) (resp vulnsrc.U
}
}()

// Create a TeeReader so that we can unmarshal into JSON and write to a SHA-1
// Create a TeeReader so that we can unmarshal into JSON and write to a hash
// digest at the same time.
jsonSHA := sha1.New()
jsonSHA := sha256.New()
teedJSONReader := io.TeeReader(jsonReader, jsonSHA)

// Unmarshal JSON.
Expand Down

0 comments on commit 8d5a013

Please sign in to comment.