Repository navigation
Expand file tree
/
Copy pathCaesarCipherTool.c.save
More file actions
executable file
·73 lines (48 loc) · 2.05 KB
/
Copy pathCaesarCipherTool.c.save
File metadata and controls
executable file
·73 lines (48 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
_____ _____ _ _ _______ _
/ ____| / ____(_) | | |__ __| | |
| | __ _ ___ ___ __ _ _ __| | _ _ __ | |__ ___ _ __| | ___ ___ | |
| | / _` |/ _ \/ __|/ _` | '__| | | | '_ \| '_ \ / _ \ '__| |/ _ \ / _ \| |
| |___| (_| | __/\__ \ (_| | | | |____| | |_) | | | | __/ | | | (_) | (_) | |
\_____\__,_|\___||___/\__,_|_| \_____|_| .__/|_| |_|\___|_| |_|\___/ \___/|_|
| |
|_|
This tool aims to create sentences using the Caesar Cipher method
_______*_______
Comments:
- No special characters, punctuation, and whitespace are allowed
_______*_______
Writed By P41n_wt55
GitHub: https://github.com/P41nwt55/CaesarCipherTool
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/*VARIAVEIS GLOBAIS QUE SERÃO USADAS
||||||||||||||||||||||||||||||||||||
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV*/
#define TAM_ALFA 27 //tamanho do alfabeto + 1 para o laço for
char alfabeto[TAM_ALFA] = {"abcdefghijklmnopqrstuvwxyz"}; //alfabeto, base da criptografia
/* inicio da função principal */
int main(int argc, char *argv[]){
char buffer[100];
int alfa_int;
int buffer_int;
int chave;
int tam_buffer;
printf("Digite o texto:");
gets(buffer); //armazena o texto digitado em buffer
printf("\nDigite a chave:");
scanf("%d",&chave); //pega a chave de criptografia
tam_buffer = strlen(buffer); //pega o tamanha de buffer para usar no laço for
for(int i = 0; i <= tam_buffer; i++){ //inicio do laço for pai
for(int j = 0; j <= TAM_ALFA;j++){ //inicio do laço for filho
buffer_int = buffer[i]; //armazena o valor int do caracter do indice 'i' dar var 'buffer'
alfa_int = alfabeto[j];
if(buffer_int == alfa_int) printf("%c",alfa_int + chave);
} //fim do laço for filho
} //fim do laço for pai
printf("\n");
return 0;
}