Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
hide.c
Go to the documentation of this file.00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <stdlib.h>
00004
00005 int main( int argc , char * argv[] )
00006 {
00007 int nkey , ikey ;
00008 unsigned char *key ;
00009 int chin , chout ;
00010
00011 if( argc < 2 || strncmp(argv[1],"-help",5) == 0 ){
00012 fprintf(stderr,"Usage: hide key < input > output\n") ;
00013 exit(1) ;
00014 }
00015
00016 key = (unsigned char *) argv[1] ; nkey = strlen(argv[1]) ;
00017 if( nkey < 1 ){ fprintf(stderr,"Illegal key\n") ; exit(1) ; }
00018
00019 ikey = 0 ;
00020 do{
00021 chin = getchar() ; if( chin == EOF ) break ;
00022 chout = ((unsigned char)chin) ^ key[ikey++] ;
00023 putchar(chout) ;
00024 ikey = ikey % nkey ;
00025 } while(1) ;
00026
00027 exit(0) ;
00028 }