18.12.2011, 21:59
(
Последний раз редактировалось Gh05t_; 19.12.2011 в 00:21.
)
Encrypt and Decrypt
Introduction
Simple encryption technique based on Caesar's cipher.
How does it work?
Replaces a character according to the shift parameter.
Functions
Example
Introduction
Simple encryption technique based on Caesar's cipher.
How does it work?
Replaces a character according to the shift parameter.
Functions
pawn Код:
stock encrypt(string[],shift)
{
for(new i=0; string[i] != '\0'; ++i)
string[i]+=shift;
}
pawn Код:
stock decrypt(string[],shift)
{
for(new i=0; string[i] != '\0'; ++i)
string[i]-=shift;
}
pawn Код:
main()
{
new string[] = "This is a string.";
encrypt(string, 13);
printf("Encrypted String: %s", string);
decrypt(string, 13);
printf("Decrypted String: %s", string);
}