Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
void rot(int c, char *str)
|
||||
{
|
||||
int l = strlen(str);
|
||||
int l = strlen(str);
|
||||
|
||||
const char* alpha_low = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
|
|
@ -21,32 +21,32 @@ void rot(int c, char *str)
|
|||
|
||||
int i; /* loop var */
|
||||
|
||||
for (i = 0; i < l; i++) /* for each letter in string */
|
||||
{
|
||||
if( 0 == isalpha(str[i]) ) continue; /* not alphabet character */
|
||||
for (i = 0; i < l; i++) /* for each letter in string */
|
||||
{
|
||||
if( 0 == isalpha(str[i]) ) continue; /* not alphabet character */
|
||||
|
||||
idx = (int) (tolower(str[i]) - 'a') + c) % 26; /* compute index */
|
||||
|
||||
if( isupper(str[i]) )
|
||||
if( isupper(str[i]) )
|
||||
subst = alpha_high[idx];
|
||||
else
|
||||
subst = alpha_low[idx];
|
||||
|
||||
str[i] = subst;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char str[] = "This is a top secret text message!";
|
||||
|
||||
printf("Original: %s\n", str);
|
||||
caesar(str);
|
||||
printf("Encrypted: %s\n", str);
|
||||
decaesar(str);
|
||||
printf("Decrypted: %s\n", str);
|
||||
|
||||
return 0;
|
||||
char str[] = "This is a top secret text message!";
|
||||
|
||||
printf("Original: %s\n", str);
|
||||
caesar(str);
|
||||
printf("Encrypted: %s\n", str);
|
||||
decaesar(str);
|
||||
printf("Decrypted: %s\n", str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue