i want to generate hash value for location in unetstack using MD5 alorithm in groovy language but i do not know how to do it. if anybody know please help me.
Asked
Active
Viewed 167 times
2 Answers
1
Generating MD5 hashes in Groovy on UnetStack is just the same as doing it in Java. You'll find plenty of resources to show you how to do that. For example, see:

Mandar Chitre
- 2,110
- 6
- 14
1
I have run this program in unetstack and it is working fine.
MD5.groovy
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
def input="300724"
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(input.getBytes());
BigInteger no = new BigInteger(1, messageDigest);
String hashtext = no.toString(16);
while (hashtext.length() < 32) {
hashtext = "0" + hashtext;
}
println "Hash_value "+hashtext;

Ashish hariyale
- 13
- 3