
com.digitalBorderlands.cityHall.impl.Password Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cityHall Show documentation
Show all versions of cityHall Show documentation
A library for accessing City Hall Enterprise Settings Server.
The newest version!
package com.digitalBorderlands.cityHall.impl;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Password {
public static String hash(String password) {
try {
if ((password == null) || password.trim().isEmpty()) {
return "";
}
byte[] bytes = password.getBytes();
byte[] encoded = MessageDigest.getInstance("MD5").digest(bytes);
StringBuffer sb = new StringBuffer();
for (byte e : encoded) {
sb.append(String.format("%02x", e));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy