⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cryptoinputstream.java

📁 java写的椭圆曲线加密(ECC)算法源码
💻 JAVA
字号:
package ecc.io;import java.io.*;import ecc.*;public class CryptoInputStream extends InputStream {    private DataInputStream in;    private CryptoSystem cs;    private Key key;    private byte[] buffer;    private int top;    private int blocksize;    public CryptoInputStream(InputStream in, CryptoSystem cs, Key key) {	this.in = new DataInputStream(in);	this.cs = cs;	this.key = key;	buffer = new byte[0];    }    public int read() throws IOException {	if(top == buffer.length) {	    try {		blocksize = in.readInt();	    } catch (EOFException e) {		return -1;	    }	    byte[] cipher = new byte[blocksize];	    in.read(cipher);	    buffer = cs.decrypt(cipher, key);	    top = 0;	}	top++;	return buffer[top-1];    }    public void close() throws IOException {	in.close();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -