标题:专家来解释一下这两个小程序撒
取消只看楼主
yukeyyo
Rank: 2
等 级:论坛游民
帖 子:22
专家分:14
注 册:2011-11-18
结帖率:100%
 问题点数:0 回复次数:1 
专家来解释一下这两个小程序撒
程序代码:
//图像文件加密
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    char ch;
    ifstream in;
    in.open("old.jpg",ios::binary);
    if(!in)
    {
        cout<<"Cannot open file.";
        return 1;
    }
    ofstream out;
    out.open("tmp.jpg",ios::binary);
    if(!out)
    {
        cout<<"Cannot open file.";
        return 1;
    }
    while(in)
    {
        in.get(ch);
        ch=ch^char(0xFF);
        if(in) out.put(ch);
    }
    in.close;
    out.close;
    return 0;
}//图像文件解密
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
    char ch;
    ifstream in;
    in.open("tmp.jpg",ios::binary);
    if(!in)
    {
        cout<<"Cannot open file.";
        return 1;
    }
    ofstream out;
    out.open("old.jpg",ios::binary);
    if(!out)
    {
        cout<<"Cannot open file.";
        return 1;
    }
    while(in)
    {
        in.get(ch);
        ch=ch^char(0xFF);
        if(in) out.put(ch);
    }
    in.close;
    out.close;
    return 0;
}


谁能告诉我加密与解密的原理是什么不?
搜索更多相关主题的帖子: include color 
2011-11-22 17:00
yukeyyo
Rank: 2
等 级:论坛游民
帖 子:22
专家分:14
注 册:2011-11-18
得分:0 
回复 2楼 Toomj
那其他加密也可以用这条语句么?
2011-11-22 17:41



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-355954-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.361792 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved