Skip to content

Commit f416b1b

Browse files
committed
Use the correct form of sha256.Sum224.
`sha256.New224().Sum(foo)` appends the SHA-224 hash for nil to foo. See https://go.dev/play/p/vSW0U3Hq4qk (SHA256 but same concept).
1 parent edd419d commit f416b1b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/encryption/aes.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ func Decrypt(data, password []byte) ([]byte, error) {
5656
func deriveKey(password []byte) []byte {
5757
buf := make([]byte, 32) // Will use AES-256
5858

59-
copy(buf, sha256.New224().Sum(password)) // Fill the rest of the hash with zeros (SHA-224 leads to a 28 byte long hash)
59+
h := sha256.Sum224(password)
60+
copy(buf, h[:]) // Fill the rest of the hash with zeros (SHA-224 leads to a 28 byte long hash)
6061

6162
return buf
6263
}

0 commit comments

Comments
 (0)