Skip to content

Instantly share code, notes, and snippets.

@tehcpu
Created June 9, 2016 22:36
Show Gist options
  • Save tehcpu/8bc43b28c6fc1e284e2ad7d01de93a53 to your computer and use it in GitHub Desktop.
Save tehcpu/8bc43b28c6fc1e284e2ad7d01de93a53 to your computer and use it in GitHub Desktop.
public String getKey() {
try {
MessageDigest msg = MessageDigest.getInstance("MD5");
msg.update(("Key:Value;Challange:cocon;Date:" + new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime())).getBytes());
byte[] msg1 = msg.digest();
StringBuffer hexString = new StringBuffer();
for (byte b : msg1) {
hexString.append(Integer.toHexString(b & 255));
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return "Key =";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment