java - SHA 256 for android app -
this question has answer here:
- java equivalent php's hmac-sha1 7 answers
i have in php method call security web service:
// token generator; date utc/gmt $tokennewinputdata = date("y-m-d"); $tokennew = hash_hmac('sha256', $tokennewinputdata, key); echo ‘token: ‘.$tokennew;
where key it's "password" text.
i must use same method android app generate security code in same way , add string call.
can me please example traslate php code android code? thanks.
write down below code.
messagedigest md = messagedigest.getinstance("sha-256"); string text = "this text"; md.update(text.getbytes("utf-8")); // change "utf-16" if needed byte[] digest = md.digest();
Comments
Post a Comment