资源描述:
《JAVA实现DES可视化界面程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、JAVA实现DES的加密解密运行结果如图:SyEcp色RunWindowH色Idr^r回百>jav<请鲁入要加在或者解密的文件路径文件玄钥文件加密文件解宏文件迭择运是明文12564?msivaA宇符加宏宇苻解密具体代码如下:packageDES;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.io.File;importjava.io.FileInputStream;importjava.io.FileOutputStream;public
2、classmydesimplementsActionListener{staticbooleana=false;staticStringkey=null;publicstaticJFramefr=newJFrame();publicstaticJTextFieldoutput=newJTextField(””);publicstaticJTextFieldlnput=newJTextField(”请输入要加密或者解密的明文,加密文件请浏览文件路径”);publicstaticJTextFieldResult=newJTextFiel
3、d(”请输入密钥,软件将自动调节密码的有效位”);publicstaticJButtonopen=newJButton(”浏览文件”);publicstaticJButtonchange=newJButton('加密文件”);publicstaticJButtonchangel=newJButton('加密字符串”);publicstaticJButtonencrypt=newJButton(*加密”);publicstaticJButtonencrypt1=newJButton('1加密”);publicstaticJButton
4、deciphering=newJButton("解密”);publicstaticJButtondeciphering1=newJButton("解密”);byte[]bytekey;publicmydes(){fr.setTitle(”DES加密解密“);intw=(Toolkit.getDefaultToolkit().getScreenSize().width-345)/2;inth=(Toolkit.getDefaultToolkit().getScreenSize().height-630)/2;fr.setLocatio
5、n(w,h);fr.setLayout(null);fr.setResizable(false);fr.setSize(565,330);open.setBounds(320,80,100,40);change.setBounds(440,20,100,40);changel.setBounds(440,20,100,40);deciphering.setBounds(440,140,100,40);encrypt.setBounds(440,80,100,40);decipheringl.setBounds(260,220,100
6、,40);encryptl.setBounds(80,220,100,40);lnput.setBounds(18,20,410,40);Result.setBounds(18,80,410,40);output.setBounds(18,140,410,40);fr.add(open);fr.add(change);fr.add(change1);fr.add(encrypt);fr.add(encryptl);fr.add(Input);fr.add(output);fr.add(deciphering);fr.add(deci
7、phering1);fr.add(Result);changel.setVisible(false);open.setVisible(false);encryptl.setVisible(false);decipheringl.setVisible(false);open.addActionListener(this);change.addActionListener(this);changel.addActionListener(this);deciphering.addActionListener(this);encrypt.a
8、ddActionListener(this);decipheringl.addActionListener(this);encryptl.addActionListener(this);fr.setVisible(true);fr.a