Skip to content

Instantly share code, notes, and snippets.

@jedahan
Last active December 14, 2015 14:38
Show Gist options
  • Select an option

  • Save jedahan/5101940 to your computer and use it in GitHub Desktop.

Select an option

Save jedahan/5101940 to your computer and use it in GitHub Desktop.
caesar encoding
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char secret[] = "MY SECRET STRING";
int main(int argc, char *argv[]) {
char encoded[strlen(secret)];
int i;
printf("Shifting '%s' by %d:\n", secret, atoi(argv[1]));
for(i=0; i < strlen(secret); i++) {
encoded[i] = secret[i] + atoi(argv[1]);
}
printf("%s\n",encoded);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment