md5 - MessageDigest...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import*; import*; public class md5 { public static void main(String args[]) { try { if (args.length != 1) { System.out.println("Usage: java md5 "); System.exit(1); } // Create an output file "digest" FileOutputStream digestStream = new FileOutputStream("digest"); // Use the MD5 algorithm. SHA will work as well
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MessageDigest md=MessageDigest.getInstance("MD5"); byte buf = args[0].getBytes(); // Update the data and digest it md.update(buf); digestStream.write(md.digest()); } catch (Exception e) { System.out.println(e); } } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online