@@ -55,6 +55,33 @@ var _ = Describe("Digest", func() {
5555 })
5656 })
5757
58+ Context ("with legacy hyphenated SHA-256 algorithm name" , func () {
59+ It ("should compute the SHA-256 digest of the file" , func () {
60+ const testFileContent = "test file content"
61+ os .WriteFile (testFile .Name (), []byte (testFileContent ), 0644 )
62+ digest , err := util .ComputeFileChecksum (testFilePath , "SHA-256" )
63+ testutil .ExpectNoErrorAndResult (err , digest , "60f5237ed4049f0382661ef009d2bc42e48c3ceb3edb6600f7024e7ab3b838f3" )
64+ })
65+ })
66+
67+ Context ("with legacy hyphenated SHA-1 algorithm name" , func () {
68+ It ("should compute the SHA-1 digest of the file" , func () {
69+ const testFileContent = "test file content"
70+ os .WriteFile (testFile .Name (), []byte (testFileContent ), 0644 )
71+ digest , err := util .ComputeFileChecksum (testFilePath , "SHA-1" )
72+ testutil .ExpectNoErrorAndResult (err , digest , "9032bbc224ed8b39183cb93b9a7447727ce67f9d" )
73+ })
74+ })
75+
76+ Context ("with legacy hyphenated SHA-512 algorithm name" , func () {
77+ It ("should compute the SHA-512 digest of the file" , func () {
78+ const testFileContent = "test file content"
79+ os .WriteFile (testFile .Name (), []byte (testFileContent ), 0644 )
80+ digest , err := util .ComputeFileChecksum (testFilePath , "SHA-512" )
81+ testutil .ExpectNoErrorAndResult (err , digest , "6543084c6981d2d3e44d295d20adee4e5fa3fc1bb2b7d3ac80ca456b0141dfd75657ba40ea5ae398824b3a871c8b7762c8bdbcbc252fa7f358d33d90ee455d86" )
82+ })
83+ })
84+
5885 Context ("with SHA3-256 algorithm" , func () {
5986 It ("should compute the SHA3-256 digest of the file" , func () {
6087 const testFileContent = "test file content"
0 commit comments