블로그 이미지
문슐랭 upip57@naver.com
진짜귀찮음

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

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
  • total
  • today
  • yesterday

'C언어'에 해당되는 글 4건

  1. 2014.05.30 c언어 파일 암호화 복호화 53
2014. 5. 30. 21:11 프로그래밍/C 언어

c언어 파일 암복호화 소개


저번에 올렸던 c언어 암복호화 프로그램은 텍스트 파일만을 암복호화가 가능하였다. 하지만 오늘 올린 이 프로램은 그 어떠한 파일도 암복호화를 할 수 있다. 이진파일을 불러들일 수 있다.


※소스파일이 필요하신 분은 메일 주시면 확인 후 바로 발송해 드리겠습니다.



프로그램 소스


#include <stdio.h>

#include <string.h>

#include <Windows.h>


void Menu();

void FileEncoding();

void FileDecoding();



void main()

{

Menu();

}


void Menu()

{

int choice;


for(;;)

{

printf("1. 파일 암호화\n2. 파일 복호화\n5. 종료\n\n");

printf("입력 : ");

scanf("%d",&choice);


if(choice<3)

{

break;

}

else

{

continue;

}

}


switch(choice)

{

case 1:

FileEncoding();

break;

case 2:

FileDecoding();

break;

case 3:

exit(1);

}

}


void FileEncoding()

{

FILE * FileCreat=NULL;

int File;

char Type[27];

system("cls");

printf("※ 확장자 까지 입력하여 주셔야 합니다.\n");

getchar();


for(;;)

{

printf("암호화 할 파일을 입력 해 주십시오 : ");

gets(Type);

FileCreat=fopen(Type,"rb");


if(FileCreat==NULL)

{

printf("\n파일이 존재하지 않습니다.\n");

continue;

}


else

{

FILE * CreatFile;

char NameType[27];

printf("\n생성 될 파일명을 적어주세요 : ");

gets(NameType);


CreatFile=fopen(NameType,"wb");


while ( (File = fgetc(FileCreat)) != EOF ) 

{

File^=13;

printf(".");

fputc(File,CreatFile);

}

fclose(CreatFile);


printf("\n\n암호화 완료! 프로그램을 종료 합니다\n");

break;

}

}

fclose(FileCreat);

}


void FileDecoding()

{

FILE * DeCodFileCreat=NULL;

int File;

char DeType[27];

system("cls");

printf("※ 확장자 까지 입력하여 주셔야 합니다.\n");

getchar();


for(;;)

{

printf("복호화 할 파일을 입력 해 주십시오 : ");

gets(DeType);

DeCodFileCreat=fopen(DeType,"rb");


if(DeCodFileCreat==NULL)

{

printf("\n파일이 존재하지 않습니다.\n");

continue;

}


else

{

FILE * DeCodCreatFile;

char DeCodNameType[27];

printf("\n생성 될 파일명을 적어주세요 : ");

gets(DeCodNameType);


DeCodCreatFile=fopen(DeCodNameType,"wb");


while ( (File = fgetc(DeCodFileCreat)) != EOF ) 

{

File^=13;

printf(".");

fputc(File,DeCodCreatFile);

}

fclose(DeCodCreatFile);


printf("\n\n복호화 완료! 프로그램을 종료 합니다\n");

break;

}

}

fclose(DeCodFileCreat);

}



GapCry.exe


※ 우클릭 해제 하였으니 맘껏 사용주세요!!!ㅋㅋ

posted by 진짜귀찮음