Java md5, the PHP way -
i have been working on hours, can't work. basically developing rest client in java rest server in php. both client , server have compute md5 of string , server compare them authentication (kinda). on server, php code is: md5("gettokenapi_keybf8ddfs845jhre980543jhsjfro93fd8capi_ver1tokeniud9er£jdfff"); that generates: 4d7b2e42c3dfd11de3e77b9fe2211b87 nice! here code client: import java.security.*; .... string s = "gettokenapi_keybf8ddfs845jhre980543jhsjfro93fd8capi_ver1tokeniud9er£jdfff"; byte[] bytesofmessage = s.getbytes("utf-8"); messagedigest md = messagedigest.getinstance("md5"); byte[] thedigest = md.digest(bytesofmessage); system.out.println("string2: " + thedigest); system.out.println("string3: " + new string(thedigest)); that generates: string2: [b@42e816 string3: m{.b�����{��!� how can java compute md5 sum same way php does, please? thanks, dan give try: public ...