-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashMe.java
More file actions
31 lines (28 loc) · 765 Bytes
/
HashMe.java
File metadata and controls
31 lines (28 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.cysecurity.cspf.jvl.model;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
*
* @author breakthesec
*/
public class HashMe {
public static String hashMe(String str)
{
StringBuffer sb=null;
try
{
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte byteData[] = md.digest();
sb= new StringBuffer();
for (int i = 0; i < byteData.length; i++)
{
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
}
catch(NoSuchAlgorithmException e)
{
}
return sb.toString();
}
}