Results 1 to 2 of 2
Thread: Getting md5sum from a cd.
- 05-11-2010, 05:42 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 46
- Rep Power
- 0
Getting md5sum from a cd.
I'm trying to figure out how to get the md5sum of a cd/dvd in Java. This is what I'm doing to get the md5sum of the iso & it works great but, what do I need to change to get the md5sum of the cd so I can compare them.
Java Code:public static byte[] createChecksum(String filename) throws Exception { InputStream fis = new FileInputStream(filename); byte[] buffer = new byte[1024]; MessageDigest complete = MessageDigest.getInstance("MD5"); int numRead; do { numRead = fis.read(buffer); if (numRead > 0) { complete.update(buffer, 0, numRead); } } while (numRead != -1); fis.close(); return complete.digest(); } public static String getMD5Checksum(String filename) throws Exception { byte[] b = createChecksum(filename); String result = ""; for (int i=0; i < b.length; i++) { result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 ); } return result; }
- 05-11-2010, 06:45 PM #2
Crossposter: New To Java - Getting md5sum from a cd.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks