Home > Backend Development > PHP Tutorial > 请同时了解java加密和PHP的帅哥,帮小弟我解决哈

请同时了解java加密和PHP的帅哥,帮小弟我解决哈

WBOY
Release: 2016-06-13 10:37:06
Original
818 people have browsed it

请同时了解java加密和PHP的帅哥,帮我解决哈。
import java.security.MessageDigest;
String s = "我是abc";
byte[] b = s.getBytes("UTF8");
for (int i = 0; i System.out.println(b[i]);//这里得到的byte数组和php的unpack("c*", $str)一样。
}
System.out.println("-------------");
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(b);
byte tmp[] = md.digest(); // MD5 的计算结果是一个 128 位的长整数
//这里得到的结果就是长度为16的字节数组了,不知道PHP如何得到
for (int i = 0; i System.out.println(tmp[i]);
}

------解决方案--------------------
从你书写的代码上看,你是完全有能力自己解决的

PHP code
$str = "我是abc";$b = unpack("C*", md5($str, 1));print_r($b);<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template