All pastes #505793 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-23 19:10 UTC
rendered paste body
/*
	by a59
*/
#include <windows.h>
#include <stdio.h>

void PrintEncrypted( char* szString, int CryptKey )
{
	int iLen = strlen( szString );

	for( int i = 0; i < iLen; i++ )
	{
		szString[ i ] ^= ( ( CryptKey * ( i + 1 ) - i ) % 32 );
		printf( "\\x%02X", szString[ i ] );
	}
}

int main( )
{
	char szCryptKey[ 6 ];
	char szBuffer[ 50 ];

	printf( "\t\t\tEncryption for ramey\n" );

	printf( "Enter a crypt key: " );
	scanf( "%s", szCryptKey );

	while( true )
	{
		printf( "Enter a string to encrypt: " );
		scanf( "%s", szBuffer );

		PrintEncrypted( szBuffer, atoi( szCryptKey ) );

		printf( "\n" );
	}

	return 0;
}