0

I am using org.apache.commons.codec.digest.DigestUtils.md5Hex() from Apache-Commons-Codec to calculate the mD5 of a concatenated string , however I get different mD5 hashcode values for the same string.

I see the following output , my expectation is that it will be same for a given string , but looks like its not .Whats the issue here ?

I generate the MD5 Hashcode using the following code and I am on centos platform.

    if (StringUtils.isNotBlank(concatenatedString)) {

        concatenatedString = StringUtils.deleteWhitespace(concatenatedString);
        //System.out.println("The concatenated string is "+concatenatedString);

        md5Hash = DigestUtils.md5Hex(concatenatedString);
        //System.out.println("The mD5 hashcode is  "+md5Hash);

    }

OutPut:

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427212?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  f20bd1bbd0063672e89d688268df0556

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427412?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  a0f99dca82fa3b3be846a9896614df9b

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427112?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  b298e7b5af0af3004a078a5c88ab9b09

The concatenated string is JaclynSmith Women'sComfortDressPumpTori-Blackhttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+SmithProductDescriptionWhetheryourlookisdressyorcasual,addaclassictouchwiththesewomen'sToripumpsbyJaclynSmith.Theseshoesfeatureshinypatent-lookuppersandwrapped,medium-heightheels.Comfortablecushionedinsolesprovideextrasupportwhiletexturedrubberoutsolesaddanon-slipfit,makingtheseround-toepumpsperfectforeverydayofficewearoraformalnightout.Slip-ondesignSyntheticleatherupperRoundtoeCushionedinsoleTexturedrubberoutsole3-in.wrappedheelCare:WipecleanImportedif(isI18NConvReq()){$("#desca").hide();}24.99http://c.shld.net/rpx/i/s/i/spin/image/spin_prod_1001427312?hei=315&wid=315&op_sharpen=1&resMode=sharp&op_usm=0.9nullKmarthttp://www.kmart.com/jaclyn-smith-women-s-comfort-dress-pump-tori-black/p-035VA51352201P//clothing-shoes-jewelry/b-1325032682?sbf=Brand&sbv=Jaclyn+Smithnullnull
The mD5 hashcode is  ffbaf47555d495b818426cc514e24c77
4

1 回答 1

7

你的输入不一样。spin_prod_ 之后的数字的倒数第二位*(或百位)分别为 2 4 1 3。(* 我最喜欢的很少使用的词之一。)

于 2015-03-02T00:51:24.627 回答