RIPEMD with Bouncy Castle Cryptography Library
Wednesday, June 24th, 2009If someone asks you to make simple tool that creates a RIPEMD-160 message digest and output it in Base64 encoding what will you do?
This is how I started:
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 32 | import org.bouncycastle.jce.provider.*; import org.bouncycastle.util.encoders.Base64; /** * Calculates RIPEMD-160 for an input message and output it in Base64 encoding * @author robert sicoie * */ public class RipeMD { private static void usage() { System.err.println( "RipeMD <message>\n" + "Calculates RIPEMD-160 for a given message and outputs it in Base64 encoding"); } /** * @param args message The message we want to calculate RIMEMD-160 for. */ public static void main(String[] args) { if (args.length < 1) { usage(); System.exit(1); } String inputMessage = args[0]; // Get the message digest generator JDKMessageDigest ripeDigest = new JDKMessageDigest.RIPEMD160(); byte [] input = inputMessage.getBytes(); byte [] output = ripeDigest.digest(input); String outputMessage = new String(Base64.encode(output)); System.out.print(outputMessage); } } |
Bouncy Castle library makes it really easy!

On 8th of July, the 