@@ -0,0 +1,1105 @@
+package railo.commons.digest;%0Aimport java.io.InputStream;%0Aimport java.security.MessageDigest;%0A%0Aimport railo.commons.io.IOUtil;%0Aimport railo.commons.io.res.Resource;%0A%0Apublic class MD5Checksum %7B%0A%0A   public static byte%5B%5D createChecksum(Resource res) throws Exception %7B%0A     InputStream is =  res.getInputStream();%0A     try%7B%0A%09     byte%5B%5D buffer = new byte%5B1024%5D;%0A%09     MessageDigest complete = MessageDigest.getInstance(%22MD5%22);%0A%09     int numRead;%0A%09     do %7B%0A%09      numRead = is.read(buffer);%0A%09      if (numRead %3E 0) %7B%0A%09        complete.update(buffer, 0, numRead);%0A%09        %7D%0A%09     %7D%0A%09     while (numRead != -1);%0A%09     %0A%09     return complete.digest();%0A     %7D%0A     finally %7B%0A    %09 IOUtil.closeEL(is);%0A     %7D%0A     %0A     %0A   %7D%0A%0A   // see this How-to for a faster way to convert %0A   // a byte array to a HEX string %0A   public static String getMD5Checksum(Resource res) throws Exception %7B%0A     byte%5B%5D b = createChecksum(res);%0A     String result = %22%22;%0A     for (int i=0; i %3C b.length; i++) %7B%0A       result +=%0A          Integer.toString( ( b%5Bi%5D & 0xff ) + 0x100, 16).substring( 1 );%0A      %7D%0A     return result;%0A   %7D%0A%7D

allow to create a checksum for a file