没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
//Java里有SHA-1这个类,只要调用就可以了。小泡子同学不辞辛劳,自我动手按照算法一步一步写了这个SHA-1,没有调用类。
package 密码学;
import java.util.*;
public class SHA_1 {
public static String 转化为二进制(String infor)
{
String message="";
int length=infor.length();
byte temp[]=infor.getBytes();
String str[]=new String[length];
for(int i=0;i<length;i++)
{
str[i]=Integer.toBinaryString(temp[i]);
for(int j=(8-str[i].length());j>0;j--)
str[i]="0"+str[i];
message=message+str[i];
}
return message;
}
public static String 增加填充位(String infor)
{
int length64=infor.length();
int d=(447-length64)%512;
String str=Long.toBinaryString(length64);
infor=infor+"1";
for(int i=1;i<=d;i++)
infor=infor+"0";
for(int j=(64-str.length());j>0;j--)
str="0"+str;
package 密码学;
import java.util.*;
public class SHA_1 {
public static String 转化为二进制(String infor)
{
String message="";
int length=infor.length();
byte temp[]=infor.getBytes();
String str[]=new String[length];
for(int i=0;i<length;i++)
{
str[i]=Integer.toBinaryString(temp[i]);
for(int j=(8-str[i].length());j>0;j--)
str[i]="0"+str[i];
message=message+str[i];
}
return message;
}
public static String 增加填充位(String infor)
{
int length64=infor.length();
int d=(447-length64)%512;
String str=Long.toBinaryString(length64);
infor=infor+"1";
for(int i=1;i<=d;i++)
infor=infor+"0";
for(int j=(64-str.length());j>0;j--)
str="0"+str;
资源评论
chen530868553
- 粉丝: 11
- 资源: 40
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功