A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© ZZT 中级黑马   /  2016-4-27 19:50  /  298 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

public class Lianxi4 {

        /**
         *图片加密   
         *将写出的字节 异或上一个数,这个数就是秘钥
         *解密时再次异或
         */
        public static void main(String[] args)  throws IOException{

                BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:\\6.jpg"));
                BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:\\1.jpg"));
               
                int b;
                while((b = bis.read()) != -1){
                        bos.write(b ^ 123);
                }
                bis.close();
                bos.close();
        }
}

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马