To fix the problem, we need to replace the use of the MD5 algorithm with a stronger, modern cryptographic algorithm such as SHA-256. This involves updating the MessageDigest.getInstance("MD5") call to use SHA-256 instead. The rest of the code logic can remain the same, as SHA-256 provides a similar interface to MD5.
Steps to fix:
Update the MessageDigest.getInstance("MD5") call to MessageDigest.getInstance("SHA-256") in both getNormalKeyStr methods.
Ensure that the rest of the code correctly handles the output of the SHA-256 hash, which is longer than the MD5 hash.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Fixes https://github.com/apache/tsfile/security/code-scanning/12
To fix the problem, we need to replace the use of the MD5 algorithm with a stronger, modern cryptographic algorithm such as SHA-256. This involves updating the
MessageDigest.getInstance("MD5")
call to useSHA-256
instead. The rest of the code logic can remain the same, as SHA-256 provides a similar interface to MD5.Steps to fix:
MessageDigest.getInstance("MD5")
call toMessageDigest.getInstance("SHA-256")
in bothgetNormalKeyStr
methods.Suggested fixes powered by Copilot Autofix. Review carefully before merging.