/* ares2005 version 0.0.1 * Release date: 24 Feb 2005 * * * Copyright 2005,2100 Stanisław Paska * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include using namespace std; int sizefile(char fn[300]) //show file size { long l,m; int roz; ifstream file (fn, ios::in|ios::binary); l = file.tellg(); file.seekg (0, ios::end); m = file.tellg(); file.close(); roz=m-l; return roz; } int arescode(char fn[300],char fn1[300],char fn2[300],int pos) { int i,k; int roz,roz1; char ch; char tp[1024]; char tp1[1024]; char psswd[1024]; srand(static_cast(time(0))); roz=sizefile(fn); roz1=roz/1024; ifstream fin(fn, ios::in|ios::binary); ifstream fin2(fn2, ios::in|ios::binary); ofstream fin1(fn1, ios::out|ios::binary); fin2.seekg(pos); for (i=0;i<256;i++) { fin2.get(psswd[i]); } fin2.close(); for (i=0;i<768;i++) { psswd[i+255]=psswd[i]; } k=0; for (i=0;i<1024;i++) { tp[i]=(psswd[i]+psswd[i]*347-i*4937847)/(i+1); tp1[i]=(tp[i]*psswd[i]+i*tp[i]*psswd[i])/(i+1); } fin1<<"STANISŁAW PASKA Warsaw POLAND"; for (i=0;i<256;i++) { fin1.put(tp1[i]); } cout<>roz; return 0; } int aresdecode(char fn[300],char fn1[300],char fn2[300],int pos) { int i,k; int roz,roz1; char ch,ch1; char tp[1024]; char tp1[1024]; char psswd[1024]; char fn3[300]="d3-3923-3-9-349d.pass"; srand(static_cast(time(0))); roz=sizefile(fn); cout<>roz; return 0; } int main(int argc, char *argv[]) { int i; char fn[300]; char fn1[300]; char fn2[300]; // 12345678901234567890 int pos; char ch; cout<<"Ares2005"<>ch; if (ch=='1') {cout<<"Code file :"<>fn; cout<<"Write a path to save this file :"<>fn1; cout<<"Write a path to password file :"<>fn2; cout<<"write a nuber password from 0 to "<>pos; arescode(fn,fn1,fn2,pos); return 0;} if (ch=='2') {cout<<"Code file :"<>fn; cout<<"Write a path to save this file :"<>fn1; cout<<"Write a path to password file :"<>fn2; cout<<"write a nuber password from 0 to "<>pos; aresdecode(fn,fn1,fn2,pos); return 0;} if (ch=='3') {return (0);} return 0; }