#include #include #include "crypto.h" int main(int argc, char *argv[]) { if (argc != 3) { std::cerr<<"SYNTAX: " << argv[0] << " inputfile key\n"; exit(1); } std::ifstream from(argv[1]); if (!from) { std::cerr << "cannot open input file " << argv[1] << std::endl; exit(1); } char ch; int i=0; char temp[KEYSIZE+1]; Crypto encrypt(argv[2]); while (from.get(ch)) { temp[i++]=ch; if (i==KEYSIZE){ temp[i] ='\0'; std::cout << encrypt.blockcipher(temp); i=0; } } if (i0){ std::cout << encrypt.blockcipher(temp,i); } // std::cout<<"\n\n"; return 0; }