코드 스크립트!!

코드 이런식으로 저장하고 싶으면 위에서 하셈


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
#include <stdio.h>
#include <string.h>
 
void encrypt(char* P, char* C,char* table)
{
    int len;
    int i,j;
 
    len=strlen(P);
 
    for(i=0; i<len; i++){
        if(P[i]>='A' && P[i]<='Z')
            C[i]=table[P[i]-'A']-('a'-'A');
        else if(P[i]>='a' && P[i]<='z')
            C[i]=table[P[i]-'a'];
        else
            C[i]=P[i];
    }
}
 
void decrypt(char* C, char* D, char* table)
{
    int len;
    int i,j;
 
    len=strlen(C);
 
    for(i=0; i<len; i++){
        if(C[i]>='A' && C[i]<='Z')
        {
            for(j=0; j<26; j++)
                if((table[j]-('a'-'A'))==C[i])
                    D[i]='A'+j;
        }
        else if(C[i]>='a' && C[i]<='z')
        {
            for(j=0; j<26; j++)
                if(table[j]==C[i])
                    D[i]='a'+j;
        }
        else
            D[i]=C[i];
    }
}
 
 
int main()
{
    char plain[50]="HelloWorld!MyNameisArgos";
    char crypt[50];
    char d_crypt[50];
    char replace_table[27]="lqkrmnedvwxaopbghifstucjyz";
 
    strcpy(crypt,plain);
    printf("replace table : %s\n",replace_table);
 
    encrypt(plain,crypt,replace_table);
    printf("encrypt message : %s\n",crypt);
 
    strcpy(d_crypt,crypt);
    decrypt(crypt,d_crypt,replace_table);
    printf("decrypt message : %s\n",d_crypt);
 
    return 0;
}
cs



'ETC' 카테고리의 다른 글

치환암호 풀어주는 웹사이트  (9) 2017.05.10
웹 툴  (0) 2017.04.25
해킹&해커관련정보 블로그  (0) 2017.04.25
해킹에 대하여... (기본)  (0) 2017.03.20
취약점 마켓, 블랙마켓  (0) 2017.03.20

+ Recent posts