When I encrypt something in Java with Java, it removes all 0s from hash, which is fine for me It does not work with php, because php does not remove 0s, there is no way to fix it (besides creating PHP removal 0s too). Here is my java code:
public string getMd5Hash (string str) {try {byte] array = MessageDigest.getInstance ("MD5"). Digest (str.getBytes ()); Stringbuffer sb = new stringbuffer (); (Int i = 0; i & lt; arrays; lan; ++ i) {sb.append (integer.txtesting ((array [i] and 0xFF) 0x100). Asbestring (1,3)); } Return sb.toString (); } Hold (Knowledge algorithm expansion e) {New invalid store expedition ("Some actually went wrong."); } Return tap; }
integer
This code shows the problem.
> import java.util.Formatter; Public category testhacks {public static final zero main (string [] args) {stringbilder sb = new stringbilder (); Formatter Format = New Formatter (SB); Byte [] testbits = {-127, 4, 64, -4}; For (int i = 0; i When driving, it creates:
81 81 04 4 40 40 FC FC Note The second row, where the integer.Taxstring only gives '4' and the formatter gives you two digits.
No comments:
Post a Comment