You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alexander Gräf (JIRA)" <ji...@apache.org> on 2009/09/11 14:38:57 UTC

[jira] Created: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
--------------------------------------------------------------------------

                 Key: CODEC-87
                 URL: https://issues.apache.org/jira/browse/CODEC-87
             Project: Commons Codec
          Issue Type: Bug
    Affects Versions: 1.4, 1.3
         Environment: Suse Enterprise Linux 10 (64bit)
            Reporter: Alexander Gräf


Actual behaviour: 

The class DigesterUtils calculates different md5-hashes depending on plattform.

I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 

The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.

Expected behaviour: 
The md5-hash should should not depend on the platform and should be equal for all platforms.

Testcase:

System.out.println(DigestUtils.md5Hex("a9P,+$")); 

produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).

The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Alexander Gräf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754960#action_12754960 ] 

Alexander Gräf commented on CODEC-87:
-------------------------------------

After a little bit of trying around I was able to reproduce the correct checksum 3194078c1fa327f9856b5b54628f2a39 with the md5sum-utility in the linuxshell.
I think you were guessing right that the encoding of the shell is responsible for the effect. I was only able to get the correct checksum if I created the file in a linux-editor (creating the file on windows was a bad idea also) and checked this file with md5sum.

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar, md5testsb.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754865#action_12754865 ] 

Sebb commented on CODEC-87:
---------------------------

Can you provide the source for Codec87.class please?

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754175#action_12754175 ] 

Henri Yandell commented on CODEC-87:
------------------------------------

I get f13ba39d06128b53b2bd238dfd357bcf on OS X using Codec.

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Alexander Gräf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Gräf updated CODEC-87:
--------------------------------

    Attachment: md5test.jar

Sorry!
As you guessed my testcase provided was not entirely  correct. The provided string that shows the problematic behaviour was not the right one.
As you confirmed, the string a9P,+$ is calculated correctly on all platforms with hash f13ba39d06128b53b2bd238dfd357bcf (i could reproduce this with the provided testcase Codec87.
However, if you use the string a9P,+§ you get the odd behaviour I was talking about.
Here are my results, using the code of testcase Codec87 with the problematic string:

79c28faa4fec5ceb98137f548f1d6fe3 Windows XP x86 5.1
3194078c1fa327f9856b5b54628f2a39 Linux amd64 2.6.16.46-0.12-smp

I attached the jar that I was using for the test. The jar contains all classes needed for execution, so you can start it with java -jar mdtest.jar.

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved CODEC-87.
-----------------------

    Resolution: Cannot Reproduce

Please provide more details if you still think there is a problem

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated CODEC-87:
----------------------

    Attachment: md5testsb.jar

Here's my version of the test case, based on Codec 1.3 (includes source for Codec87)

And here are some results:

79c28faa4fec5ceb98137f548f1d6fe3 Windows XP x86 5.1 Cp1252
79c28faa4fec5ceb98137f548f1d6fe3 FreeBSD amd64 7.2-STABLE ISO8859_1
6cfc74991f7a53c110c76634c51d9af0 SunOS x86 5.10 ASCII

So it does indeed look like there is a problem here.

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar, md5testsb.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Alexander Gräf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Gräf updated CODEC-87:
--------------------------------

    Comment: was deleted

(was: Sorry!
As you guessed my testcase provided was not entirely  correct. The provided string that shows the problematic behaviour was not the right one.
As you confirmed, the string a9P,+$ is calculated correctly on all platforms with hash f13ba39d06128b53b2bd238dfd357bcf (i could reproduce this with the provided testcase Codec87.
However, if you use the string a9P,+§ you get the odd behaviour I was talking about.
Here are my results, using the code of testcase Codec87 with the problematic string:

79c28faa4fec5ceb98137f548f1d6fe3 Windows XP x86 5.1
3194078c1fa327f9856b5b54628f2a39 Linux amd64 2.6.16.46-0.12-smp

I attached the jar that I was using for the test. The jar contains all classes needed for execution, so you can start it with java -jar mdtest.jar.)

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754130#action_12754130 ] 

Sebb commented on CODEC-87:
---------------------------

AFAICT the digest for "a9P,+$" is actually "f13ba39d06128b53b2bd238dfd357bcf", confirmed by using Perl Digest::MD5.

Are you sure the test case is correct?

What is the default encoding used on the Windows and Suse systems?

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754924#action_12754924 ] 

Sebb commented on CODEC-87:
---------------------------

I suspect that the shell may not be handling the conversion correctly, i.e. md5sum may not be seeing what you think.
[I assume it's unlikely that md5sum is incorrect.]

Try creating a file containing the special character(s) and see how that behaves on different hosts.


> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar, md5testsb.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Julius Davies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754209#action_12754209 ] 

Julius Davies commented on CODEC-87:
------------------------------------

I'm surprised character encoding could be an issue with these lower-ascii characters in the first place.  Something like DigestUtils.md5Hex("résumé") would be better suited to catch a character encoding issue.



> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Alexander Gräf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754916#action_12754916 ] 

Alexander Gräf commented on CODEC-87:
-------------------------------------

Yes, you are right, when I use the testcase I am able to see your result:

3194078c1fa327f9856b5b54628f2a39 Linux amd64 2.6.16.46-0.12-smp UTF-8

Thank you for responding so fast to my requests!

However, what still bothers me now, is that the test:
echo -n "a9P,+§" | md5sum
on my linuxshell still produces:
79c28faa4fec5ceb98137f548f1d6fe3

Maybe we should check this on an alternative UNIX-platform?



> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar, md5testsb.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754906#action_12754906 ] 

Sebb commented on CODEC-87:
---------------------------

However, tests with Codec 1.4 show the following:

3194078c1fa327f9856b5b54628f2a39 Windows XP x86 5.1 Cp1252
3194078c1fa327f9856b5b54628f2a39 SunOS x86 5.10 ASCII
3194078c1fa327f9856b5b54628f2a39 FreeBSD amd64 7.2-STABLE ISO8859_1

It looks like this is a problem that was fixed in Codec 1.4 - please can you try again using Codec 1.4?

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar, md5testsb.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Alexander Gräf (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754873#action_12754873 ] 

Alexander Gräf commented on CODEC-87:
-------------------------------------

Ok, here is the sourcecode, i made one extension just now to print out  the codepage that is envolved:

{code}
import org.apache.commons.codec.digest.*;

public class Codec87 {

  public static void main(String[] args) {
    String osName = System.getProperty("os.name");
    String osArch = System.getProperty("os.arch");
    String osVersion = System.getProperty("os.version");
    String encoding = System.getProperty("sun.jnu.encoding");

    System.out.println(DigestUtils.md5Hex("a9P,+§") + " " + osName + " " + osArch + " " + osVersion + " " + encoding);
  }
}
{code}

The codepages that were involved in my test are:

- CP1252 on Windows XP
- UTF-8 on Suse Enterprise Linux 10


> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Julius Davies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754199#action_12754199 ] 

Julius Davies commented on CODEC-87:
------------------------------------

I created the following Java class to test this:

{code}
import org.apache.commons.codec.digest.*;

public class Codec87 {

  public static void main(String[] args) {
    String osName = System.getProperty("os.name");
    String osArch = System.getProperty("os.arch");
    String osVersion = System.getProperty("os.version");

    System.out.println(DigestUtils.md5Hex("a9P,+$") + " " + osName + " " + osArch + " " + osVersion);
  }
}
{code}




$ echo -n "a9P,+$" | md5sum
----------------------------------------
f13ba39d06128b53b2bd238dfd357bcf  -

java -cp commons-codec-1.4.jar:. Codec87
----------------------------------------
f13ba39d06128b53b2bd238dfd357bcf Linux        ppc   2.6.30-1-powerpc
f13ba39d06128b53b2bd238dfd357bcf Linux        amd64 2.6.30-1-amd64
f13ba39d06128b53b2bd238dfd357bcf Windows 2000 x86   5.0


The results were the same for me using Codec-1.3 and Codec-1.4.  This is the same result Henri (OSX) and Sebb (Perl) obtained.  Notice my first result came from md5sum unix command.




> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved CODEC-87.
-----------------------

    Resolution: Fixed

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar, md5testsb.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Alexander Gräf (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Gräf reopened CODEC-87:
---------------------------------


Sorry!
As you guessed my testcase provided was not entirely  correct. The provided string that shows the problematic behaviour was not the right one.
As you confirmed, the string a9P,+$ is calculated correctly on all platforms with hash f13ba39d06128b53b2bd238dfd357bcf (i could reproduce this with the provided testcase Codec87.
However, if you use the string a9P,+§ you get the odd behaviour I was talking about.
Here are my results, using the code of testcase Codec87 with the problematic string:

79c28faa4fec5ceb98137f548f1d6fe3 Windows XP x86 5.1
3194078c1fa327f9856b5b54628f2a39 Linux amd64 2.6.16.46-0.12-smp

I attached the jar that I was using for the test. The jar contains all classes needed for execution, so you can start it with java -jar mdtest.jar.

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CODEC-87) DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CODEC-87?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12754877#action_12754877 ] 

Sebb commented on CODEC-87:
---------------------------

Thanks.
Might be useful to show the default charset:

{code}
// jdk1.4
System.out.println(new java.io.OutputStreamWriter(new java.io.ByteArrayOutputStream()).getEncoding());
// jdk1.5
System.out.println(java.nio.charset.Charset.defaultCharset().name());
{code}

This more portable than relying on a (private) Sun property.

> DigestUtils: MD5 checksum is not calculated correctly on linux64-platforms
> --------------------------------------------------------------------------
>
>                 Key: CODEC-87
>                 URL: https://issues.apache.org/jira/browse/CODEC-87
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>         Environment: Suse Enterprise Linux 10 (64bit)
>            Reporter: Alexander Gräf
>         Attachments: md5test.jar
>
>
> Actual behaviour: 
> The class DigesterUtils calculates different md5-hashes depending on plattform.
> I used jdk1.5.0_19-32bit on win32 and jdk1.5.0_19-64bit on SLES 10 (64-bit) for testing. 
> The effect depends on the charactersequence that is used for the calculation of the hash. There are some charactersequences that are calculated correctly. I think that the hash that is calculated on Windows 32 is the correct one since we have checked it by using an other library for calculating md5-hashes (Tagish-Auth-1.0.3). Since both of the tested libraries internally make use of the class java.security.MessageDigest but differ in the way the calculated byte[] is transformed in a hex-string, I think that the problem is located in the Hex.encodeHex(byte[] hashedBytes) method.
> Expected behaviour: 
> The md5-hash should should not depend on the platform and should be equal for all platforms.
> Testcase:
> System.out.println(DigestUtils.md5Hex("a9P,+$")); 
> produces the hash 79c28faa4fec5ceb98137f548f1d6fe3 on Windows XP (32bit).
> The same instruction produces 3191078c1fa327f9856b5b54628f2a39 on Suse Enterprise Linux 10 (64bit).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.