int BUFFERLEN = 512;
FileInputStream in = new FileInputStream(fPath1+fnn);
File file = new File(fPath+fnn);
if (!file.exists())
file.createNewFile(); FileOutputStream out = new FileOutputStream(file);
int c, pos, keylen;
pos = 0;
byte[] KEYVALUE=this.pwd.getBytes();
keylen = KEYVALUE.length;
byte buffer[] = new byte[BUFFERLEN];
while ((c = in.read(buffer)) != -1) {
for (int i = 0; i < c; i++) {
buffer[i] ^= KEYVALUE[pos];
out.write(buffer[i]);
pos++;
if (pos == keylen){
pos = 0;
}
如何判断解密是否成功,该怎么写?密码是通过PWD传进来的值
FileInputStream in = new FileInputStream(fPath1+fnn);
File file = new File(fPath+fnn);
if (!file.exists())
file.createNewFile(); FileOutputStream out = new FileOutputStream(file);
int c, pos, keylen;
pos = 0;
byte[] KEYVALUE=this.pwd.getBytes();
keylen = KEYVALUE.length;
byte buffer[] = new byte[BUFFERLEN];
while ((c = in.read(buffer)) != -1) {
for (int i = 0; i < c; i++) {
buffer[i] ^= KEYVALUE[pos];
out.write(buffer[i]);
pos++;
if (pos == keylen){
pos = 0;
}
如何判断解密是否成功,该怎么写?密码是通过PWD传进来的值
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货