📄 main.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package aeslab;/** * * @author Fredrik */public class Main { /** * @param args the command line arguments */ //example of encryption decryption from the AES standard document public static void main(String[] args) { byte[] key={(byte)0x2b,(byte)0x7e,(byte)0x15,(byte)0x16, (byte)0x28,(byte)0xae,(byte)0xd2,(byte)0xa6, (byte)0xab,(byte)0xf7,(byte)0x15,(byte)0x88, (byte)0x09,(byte)0xcf,(byte)0x4f,(byte)0x3c}; byte[] plaintext={(byte)0x32,(byte)0x43,(byte)0xf6,(byte)0xa8, (byte)0x88,(byte)0x5a,(byte)0x30,(byte)0x8d, (byte)0x31,(byte)0x31,(byte)0x98,(byte)0xa2, (byte)0xe0,(byte)0x37,(byte)0x07,(byte)0x34}; byte[] ciphertext; AES cipher = new AES(key); ciphertext=cipher.encrypt(plaintext); for(int i=0;i<16;i++) System.out.printf("%02x ",ciphertext[i]); System.out.println(); byte[] key2={(byte)0x00,(byte)0x01,(byte)0x02,(byte)0x03, (byte)0x04,(byte)0x05,(byte)0x06,(byte)0x07, (byte)0x08,(byte)0x09,(byte)0x0a,(byte)0x0b, (byte)0x0c,(byte)0x0d,(byte)0x0e,(byte)0x0f}; byte[] plaintext2={(byte)0x00,(byte)0x11,(byte)0x22,(byte)0x33, (byte)0x44,(byte)0x55,(byte)0x66,(byte)0x77, (byte)0x88,(byte)0x99,(byte)0xaa,(byte)0xbb, (byte)0xcc,(byte)0xdd,(byte)0xee,(byte)0xff}; byte[] ciphertext2; AES cipher2 = new AES(key2); ciphertext2=cipher2.encrypt(plaintext2); System.out.println("Encrypted"); for(int i=0;i<16;i++) System.out.printf("%02x ",ciphertext2[i]); System.out.println(); byte[] decrypted=cipher2.decrypt(ciphertext2); System.out.println("Decrypted"); for(int i=0;i<16;i++) System.out.printf("%02x ",decrypted[i]); System.out.println(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -