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

📄 cryptooutputstream.java

📁 java写的椭圆曲线加密(ECC)算法源码
💻 JAVA
字号:
package ecc.io;import java.io.*;import ecc.*;public class CryptoOutputStream extends OutputStream {    private DataOutputStream out;    private CryptoSystem cs;    private Key key;    private byte[] buffer;    private int top;    public CryptoOutputStream(OutputStream out, CryptoSystem cs, Key key) {	this.out = new DataOutputStream(out);	this.cs = cs;	this.key = key;	buffer = new byte[cs.blockSize()];    }    private void writeOut() throws IOException {	if(top == 0) return;	byte[] cipher = cs.encrypt(buffer, top, key);	out.writeInt(cipher.length);	out.write(cipher);	top = 0;    }    public void write(int b) throws IOException {	buffer[top] = (byte) b;	top++;	if(top == buffer.length) writeOut();    }    public void flush() throws IOException {	writeOut();	out.flush();    }    public void close() throws IOException {	out.close();    }}

⌨️ 快捷键说明

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