Groovy web console

subscribe to the feed Subscribe
to this
site
SHA1 generator (via #groovywebconsole)
tweet this snippet Tweet
this
script

SHA1 generator

Published 2 years ago by domak
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import java.security.*;
String  password = "toto\n";
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
byte[] digest  = sha1.digest(password.getBytes());
System.out.println(new  BigInteger(1, digest).toString(16));