Revision: 62294
Updated Code
at February 14, 2013 04:36 by laurenceosx
Updated Code
def fileToMd5(File aFile) { def digest = java.security.MessageDigest.getInstance("MD5"); aFile.withInputStream{ inpStream -> byte[] buffer = new byte[8192]; int read = 0; while( (read=inpStream.read(buffer)) > 0 ) { digest.update(buffer, 0, read); } } byte[] md5sumByteArray = digest.digest(); def bigInt = new BigInteger(1, md5sumByteArray); return bigInt.toString(16).padLeft(32, '0'); }
Revision: 62293
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 14, 2013 04:34 by laurenceosx
Initial Code
def fileToMd5(File aFile) { def digest = java.security.MessageDigest.getInstance("MD5"); aFile.withInputStream{ inpStream -> byte[] buffer = new byte[8192]; int read = 0; while( (read=inpStream.read(buffer)) > 0 ) { digest.update(buffer, 0, read); } } byte[] md5sumByteArray = digest.digest(); def bigInt = new BigInteger(1, md5sumByteArray); return bigInt.toString(16).padLeft(32, '0'); }
Initial URL
Initial Description
Groovy fileToMd5
Initial Title
Groovy fileToMd5
Initial Tags
groovy
Initial Language
Groovy