HuyPV
Wednesday, November 10, 2010
# Java code
//axis.jar -> Base64
import java.security.*;
MessageDigest dig = MessageDigest.getInstance("SHA1");
byte[] bs = dig.digest(strToHash.getBytes("UTF-16LE"));
return new String(org.apache.axis.encoding.Base64.encode(bs)).replaceAll("(\\r|\\n)", "");
# PHP code
$utfString = mb_convert_encoding($strToHash,"UTF-16LE");
$hashTag = sha1($utfString, true);
return str_replace(array("\r", "\n"), "", base64_encode($hashTag));
Title:
Security Encrypt string Java to PHP
Description:
# Java code //axis.jar -> Base64 import java.security.*; MessageDigest dig = MessageDigest.getInstance("SHA1"); byte[] bs ...
...
Rating:
4