Hi Tharindu Did you try to hash those files manually ? If not try to hash those files manually(i.e *md5sum file.txt) *and check hash values are same
Thanks, Iqbal On Sun, Mar 1, 2015 at 12:30 PM, Tharindu Dharmarathna <[email protected]> wrote: > Hi all, > > I wrote test case on APIDocDownload for the API Manager .When I Run the > tests It gives me two md5sums for equal files . > > here's the code sample I write to get md5 value from the files > > private String readMD5(InputStream inputStream) throws >> NoSuchAlgorithmException, IOException { >> MessageDigest md = MessageDigest.getInstance("MD5"); >> byte[] dataBytes = new byte[1024]; >> int read; >> try { >> while ((read = inputStream.read(dataBytes)) != -1) { >> md.update(dataBytes, 0, read); >> } >> } catch (IOException e) { >> log.error("File couldn't found to read md5", e); >> throw e; >> } finally { >> inputStream.close(); >> } >> byte[] mdBytes = md.digest(); >> //convert the byte to hex format >> StringBuilder sb = new StringBuilder(); >> for (byte mdByte : mdBytes) { >> sb.append(Integer.toString((mdByte & 0xff) + 0x100, 16).substring(1)); >> } >> return sb.toString(); >> } > > Is there any best way to get two files are identical ?. > > Thanks > > -- > > *Tharindu Dharmarathna*Associate Software Engineer > WSO2 Inc.; http://wso2.com > lean.enterprise.middleware > > mobile: *+94779109091 <%2B94779109091>* > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Irham Iqbal Software Engineer - Test Automation WSO2, Inc.: http://wso2.com lean. enterprise. middleware phone: +94 777888452
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
