The length is same. I tested it by printing the length in the standard output.
I used a folder comparison software to find exactly where things went wrong. It showed that the content of jar file was a mismatch. So I extracted the jars and then compared it again but the extracted files did not have any difference.
So I guess the problem lies on the archiving task of ant i.e <jar>. So Is there any way by which I can get consistent ouput for the same.