java - 30 char md5 digest -


I create the blb data for md5 Use the database.

  md5checksum.update (byte [] --- read from database); String result = new bigigner (1, MD5 checkersDigest ()). Tosting (16);  

The checksum I received is changing to length (30-32) for different byte arrays. For 31 character length checksum, as I have understood that leading zero removal can have an effect. (I handled it by adding the leading zero)

Can anyone tell me why in some cases why am I getting 30 characters?

Thanks, Gemini

Do not convert any digest into any number!

Use something like this:

  byte [] B = MD5 checkers damester (); // Now convert these bytes  

There are several different methods for changing byte: HexStrings:

  Public class HexConverter {// thank you To http://www.rgagnon.com/javadetails/java-0596.html Fixed private last string hex = "0123456789 ABCDEF"; Public string tohex (byte [raw] {if (raw == null) {return null; } Last StringBinder hex = new string builder (2 * raw.length); (Last Byte B: Raw) {Hex.Append (Hex. Chatt ((B & 0x F 0)> 4) Attachment (hexas.chart (b & fff)); } Return hex.toString (); }}  

or (This link shows how to digest utilities from Apaca Commons Coke)

  public stable string mill MD5 checks (string Filename) Exceptions thrown {Byte [B] = CreateCaxus (filename); String result = ""; (Result = + integer.tstring ((b [ii] and 0xff) + 0x100, 16). Asbestring (1);} return result for (int i = 0; i & lt; b. Length; i ++) ;}  

Comments