SHA-256 加密 php 有相关的函数吗
3 回答
慕丝7291255
TA贡献1859条经验 获得超6个赞
import java.security.MessageDigest;
public class Test{
public static void main(String[] args) {
String t= "abcd";
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(t.getBytes("GBK"));
for(byte b:md.digest())
System.out.format("%02X",b);
} catch (Exception e) {
e.printStackTrace();
}
}
}
=========
88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589
PHP验证
<?php
echo hash('sha256', 'abcd');
88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031589
验证无误
添加回答
举报
0/150
提交
取消