Skip to content

Commit

Permalink
Update vigenere.c
Browse files Browse the repository at this point in the history
  • Loading branch information
lukalafaye authored Jan 19, 2018
1 parent 7bc7703 commit fddf0dc
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions C/vigenere.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ int keywordFix(char* string) {
char* j = string;
while (*j != '\0') {
*i = *j++;
// Any non-alphabet characters will be overwritten by the next alphabet character.
// lower case letters switches to capital. Keywords look cooler when all capped
if ( ( *i >= 'a' ) && ( *i <= 'z' ) ) {
*i = toupper(*i);
i++;
Expand All @@ -75,9 +73,6 @@ int keywordFix(char* string) {
}
}

// If just letters, *cipherText = [(*text-'A') + (*keyword-'A')] % 26 + 'A' <---- We use this one.
// If all possible characters, range is ASCII CODE 32 ~ 126
// In that case, *cipherText = [(*text-' ') + (*keyword-'A')] % 95 + ' '
void vCipher(char* string, char* keyword, int action) {

int i = 0;
Expand All @@ -86,7 +81,6 @@ void vCipher(char* string, char* keyword, int action) {
char* key = keyword;
if ( action == ENCODE) {
while (*str != '\n' && *str != '\0') {
//*str = ( (*str-' ')+(keyword[i%len]-'A') )%95 + ' ';
if ( (*str >= 'a') && (*str <= 'z') ) {
*str = ( (*str-'a')+(keyword[i%len]-'A') )%26 + 'a';
i++;
Expand Down

0 comments on commit fddf0dc

Please sign in to comment.