Skip to content

Commit

Permalink
[SONAR] Fixed weak hash algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
leonegiorgia committed Jul 30, 2024
1 parent e7dea2e commit c693910
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private static String createRolesString(Collection roles) {
}

public static String calculateHash(StringBuilder str) throws Exception {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
MessageDigest algorithm = MessageDigest.getInstance("SHA-512");
String is = new String(str);
DigestInputStream dis = new DigestInputStream(new ByteArrayInputStream(is.getBytes()), algorithm);
while (dis.read() != -1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public class PasswordEncrypter {
private Mac mac = null;
private static final String PROVIDER = "HmacSHA1";
private static final String PROVIDER = "SHA-512";

public PasswordEncrypter(byte[] keyBytes) {
// All com.sun.crypto.** classes are JDK internal APIs that are not supported and should not be used.
Expand Down

0 comments on commit c693910

Please sign in to comment.