Advertisement
2002VB Security #24662

Text encrypter

*UPDATED* Now uses a more recursive and less pattern oriented algorithm. Basically encrypts a text type file using a simple recursive character shift techinque. Pretty basic, but powerful.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
#include	<stdio.h>
#include	<conio.h>
#include	<stdlib.h>
#include	<math.h>
FILE	*stream;
FILE	*streamout;
//	The key can be up to 100 characters,
//	will accept and use spaces, and is
//	case sensitive. The only way to decypher
//	the file is to know the key. Kinda neat,
//	because even if you know the algorithm,
//	it doesn't do you any good.
int main(int argc, char *argv[]){
	char			y;
	int				x;
	int				z;
	int				i;
	unsigned char	input[100];
	unsigned char	output[100];
	unsigned char	key[100];
	
	printf("Enter Input Filename -> ");
	scanf("%s",input);
	printf("Enter Output Filename -> ");
	scanf("%s",output);
	getchar();
	printf("Enter Key -> ");
	scanf("%[^\n]",key);
	stream=fopen(input,"r");
	streamout=fopen(output,"w");
	z=1;
	do{
		y=fgetc(stream);
		if(y!=EOF){
			x=(int)y;
			for(i=0;key[i];i++)
				x=x^key[i];
			x^=z;
			z^=2^z;
			fprintf(streamout,"%c",x);
		}							
	}while(y!=EOF);					
	fclose(stream);
	fclose(streamout);
	printf("press any key to continue");
	while(!kbhit());  //wait to exit
	return 0;
}
Original Comments (3)
Recovered from Wayback Machine