Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string wejscie,klucz;
- int j=0;
- unsigned n,x,c,poz=0,wynik=1;
- key>>klucz;
- input>>wejscie;
- const char* buf = wejscie.c_str();
- if(flaga_algorytmu==false)
- {
- x=(int)strtoul(klucz.substr(0,2).c_str(),NULL,16);
- }
- else
- {
- x=(int)strtoul(klucz.substr(0,2).c_str(),NULL,16);
- }
- n=(int)strtoul(klucz.substr(klucz.find(";")+1,2).c_str(),NULL,16);
- while(poz<wejscie.length())
- {
- wynik=1;
- c = (int)wejscie[poz];
- poz++;
- if(flaga_algorytmu==false)
- {
- c%=n;
- for(int i=0; i<x; i++)
- {
- wynik *= c;
- wynik %= n;
- }
- output << (char)wynik;
- }
- else
- {
- c%=n;
- for(int i=0; i<x; i++)
- {
- wynik *= c;
- wynik %= n;
- }
- output << (char)wynik;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement