Encryption is a process that changes a code which can be understood to be a code that can not be understood (illegible). Encryption can be interpreted as a code or cipher. A cipher using an algorithm that can encode all data streams (stream) bits of a message into an incomprehensible cryptogram (unintelligible). Because cipher technique is a system that has been prepared for the automation, then the technique used in computer and network security systems.
While the description is a process to return the results of a cipher to the code beginning or the beginning of the data entered.
Algorithm.Program And Description In C + +.
• Encryption
Print encryption algorithm
Declaration:
plain, cipher: string
key, i: Integer
Description:
read (key, plain)
for i = 0 to strlen (plain) do
ciphers [i] <= (plain [i] + key) mod 128;
end for
write (cipher)
• Description
Print a description of the algorithm
Declaration:
ciphers, text: string
key, i: Integer
Description:
read (key, cipher)
for i = 0 to strlen (cipher) do
text [i] <= (cipher [i] - key) mod 128;
end for
write (text)
# Include
# Include
using namespace std;
cryptography class {
friend istream & operator>> (istream &, cryptography &);
friend ostream & operator <<(ostream &, cryptography &);
public:
cryptography ();
void encryption ();
void description ();
private:
char plain [100], cipher [100], text [26];
int key;
};
cryptography:: cryptography () {
court <<"Program encrypt and Description C++ \ n \ n";
court <
}
istream & operator>> (istream & ins, cryptography & mlebu) {
court <<"Enter key:";
in>> mlebu.key;
court <<"Enter character:";
in>> mlebu.plain;
return in;
}
void cryptography: encryption () {
for (int i = 0; i
ciphers [i] = (plain [i] + key)% 128;}
court <<
}
void cryptography:: description () {
for (int i = 0; i
text [i] = (cipher [i]-key)% 128;}
}
ostream & operator <<(ostream & out, cryptography & metu) {
out <<"the result of encryption:";
for (int i = 0; i
out <
}
out <
out <<"the description:";
for (int j = 0; j
court <
}
out <<
return out;
}
int main (int argc, char * argv [])
{
cryptography x;
cin>> x;
x.enkripsi ();
x.deskripsi ();
court <
system ("PAUSE");
return EXIT_SUCCESS;
}
0 comments:
Posting Komentar