⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 AES,DES,RSA,SHA1四个加密解密算法。
💻 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 + -