Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions util/digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func ComputeFileChecksum(filePath, algorithm string) (string, error) {
hasher = sha1.New()
case "SHA256":
hasher = sha256.New()
case "SHA384", "SHA-384":
hasher = sha512.New384()
case "SHA512":
hasher = sha512.New()
default:
Expand Down
9 changes: 9 additions & 0 deletions util/digest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ var _ = Describe("Digest", func() {
})
})

Context("with SHA-384 algorithm name (as returned by deploy service for FIPS+NCS)", func() {
It("should compute the SHA-384 digest of the file", func() {
const testFileContent = "test file content"
os.WriteFile(testFile.Name(), []byte(testFileContent), 0644)
digest, err := util.ComputeFileChecksum(testFilePath, "SHA-384")
testutil.ExpectNoErrorAndResult(err, digest, "4b87814537ab46771af4f37f259d6321f8c36b9e0d9ed1eda10005031cf7de752b9937a9cfe02744a3fc9785c3106317")
})
})

AfterEach(func() {
testFile.Close()
os.Remove(testFileName)
Expand Down
Loading