📄 main.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package SHA1;import java.io.File;import java.io.FileInputStream;import java.io.IOException;/** * * @author Fredrik */public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ // Hash the test messages in the SHA-1 standard document String filename = "D:\\My Documents\\test.JPG"; File sourceFile = new File(filename); //String enfile = filename + ".encrypt"; //File encryptfile = new File(enfile); int fileSize = (int) (sourceFile.length()); byte[] buff = new byte[fileSize]; //FileOutputStream out = null; FileInputStream in = new FileInputStream(sourceFile); in.read(buff); in.close(); SHA1 hashFunction = new SHA1(); for(int i=0;i<buff.length;i++) buff[i]="a".getBytes()[0]; byte[]hashVal=hashFunction.hash(buff); for(int i=0;i<20;i++) System.out.printf("%02x ",hashVal[i]); System.out.println(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -