资源描述:
《JAVA 实现 DES 可视化界面程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、JAVA实现DES的加密解密运行结果如图:具体代码如下:packageDES;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.io.File;importjava.io.FileInputStream;importjava.io.FileOutputStream;publicclassmydesimplementsActionListener{staticbooleana=false;staticStringkey=null;pu
2、blicstaticJFramefr=newJFrame();publicstaticJTextFieldoutput=newJTextField("");publicstaticJTextFieldInput=newJTextField("请输入要加密或者解密的明文,加密文件请浏览文件路径");publicstaticJTextFieldResult=newJTextField("请输入密钥,软件将自动调节密码的有效位");publicstaticJButtonopen=newJButton("浏览文件");public
3、staticJButtonchange=newJButton("加密文件");publicstaticJButtonchange1=newJButton("加密字符串");publicstaticJButtonencrypt=newJButton("加密");publicstaticJButtonencrypt1=newJButton("加密");publicstaticJButtondeciphering=newJButton("解密");publicstaticJButtondeciphering1=newJButto
4、n("解密");byte[]bytekey;publicmydes(){fr.setTitle("DES加密解密");intw=(Toolkit.getDefaultToolkit().getScreenSize().width-345)/2;inth=(Toolkit.getDefaultToolkit().getScreenSize().height-630)/2;fr.setLocation(w,h);fr.setLayout(null);fr.setResizable(false);fr.setSize(565,3
5、30);open.setBounds(320,80,100,40);change.setBounds(440,20,100,40);change1.setBounds(440,20,100,40);deciphering.setBounds(440,140,100,40);encrypt.setBounds(440,80,100,40);deciphering1.setBounds(260,220,100,40);encrypt1.setBounds(80,220,100,40);Input.setBounds(18,20
6、,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(encrypt1);fr.add(Input);fr.add(output);fr.add(deciphering);fr.add(deciphering1);fr.add(Result);change1.setVisible(false);open
7、.setVisible(false);encrypt1.setVisible(false);deciphering1.setVisible(false);open.addActionListener(this);change.addActionListener(this);change1.addActionListener(this);deciphering.addActionListener(this);encrypt.addActionListener(this);deciphering1.addActionListe
8、ner(this);encrypt1.addActionListener(this);fr.setVisible(true);fr.addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit