zoukankan      html  css  js  c++  java
  • 代码实现将写出的字节异或上一个数,这个数就是密钥,解密的时候再次异或就可以

    package com.loaderman.test;
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    public class Test {
    	/**
    	 * @param args
    	 * @throws IOException 
    	 * 将写出的字节异或上一个数,这个数就是密钥,解密的时候再次异或就可以了
    	 */
    	public static void main(String[] args) throws IOException {
    		BufferedInputStream bis = new BufferedInputStream(new FileInputStream("copy.jpg"));
    		BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("copy2.jpg"));
    		int b;
    		while((b = bis.read()) != -1) {
    			bos.write(b ^ 123);
    		}
    		bis.close();
    		bos.close();
    	}
    }
    
  • 相关阅读:
    数据访问类
    批量删除与查询
    CRUD
    数据访问与全局变量
    设计模式
    加载类
    PDO数据访问抽象层(上)
    PDO数据访问抽象层(下)
    会话控制
    php租房题目
  • 原文地址:https://www.cnblogs.com/loaderman/p/6516602.html
Copyright © 2011-2022 走看看