SNU

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ SNU ] in KIDS
글 쓴 이(By): gmork (Ryu, M.S.)
날 짜 (Date): 1995년03월15일(수) 23시19분04초 KST
제 목(Title): Ciphering program-아래아한글...기사를 보


Unix용으로 제작한 사제 암호화 프로그램입니다 도스에서는 인티저 사이즈가
유닉스와 틀려서 약간 이상할텐데 화일을 바이너리로 열도록 고쳐서 쓰면 됩니다.
유닉스(선 오에스 3)의 씨 컴파일러가 후져서 커니건 앤드 리치 스타일 코드로 
짰습니다.
스타일을 중요시하시는 분은 피씨에서 앤시 스타일로 고쳐보십시오...
짤릴까봐 두쪼각냈읍니다.
-------------------------------------------
/******************************************
 *              cipher.c                  *
 * Ciphers and deciphers a file with user *
 * provided keyword using XOR-ed Vigenere *
 * cipher algorithm.                      *
 ******************************************/

#include <stdio.h>
#include <stdlib.h>

main(argc, argv)
int argc;
char **argv;
{
    FILE *in_file, *out_file, *fopen();
    int ch, key_length, key_p=0, i;
    char key[256];

    if(argc<3)        /* gets two arguments */
    {
        printf("%c Usage : %s <in_file> <out_file>\n",7, argv[0]);
        exit(1);
    }

    if((in_file=fopen(argv[1],"rb"))==NULL)   /* if input file is absent */
    {
        printf("\aCannot open %s : exiting...\n",argv[1]);
        exit(2);
    }

    out_file=fopen(argv[2],"wb");

    printf("Key : ");          /* prompt for keyword */
    system("stty -echo");      /* do not echo keyword */

    i=0;                       /* get user keyword */
    while((ch=getchar()) != '\n')
        key[i++] = ch;
-------------------------------------------------------------------------------
-----
 
[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.