Category : C Source Code
Archive   : CRYPT.ZIP
Filename : CRYPT.C

 
Output of file : CRYPT.C contained in archive : CRYPT.ZIP
/****************************************************************/
/* */
/* Encrypt/decrypt data */
/* */
/* Copyright 1987-1989 by Robert B. Stout dba MicroFirm */
/* */
/* This code may be used freely in any program for any */
/* application, personal or commercial. */
/* */
/* Available as part of Steve Margison's C library for the */
/* Zortech C/C++ and Turbo C compilers. */
/* */
/* Also available for dedciated file encryption as part of */
/* Mike Smedley's CXL windowing library, and for stand-alone */
/* file encryption as part of the LYNX and CRYPT utilities */
/* in the MicroFirm Toolkit, versions 3.00 and above. */
/* */
/****************************************************************/

char *cryptext; /* The actual encryption/decryption key */
int crypt_ptr = 0; /* Circular pointer to elements of key */
int crypt_length; /* Set externally to strlen(cryptext) */

/* NOTES: cryptext should be set and qualified (to something over
5-6 chars, minimum) by the calling program, which should
also reset crypt_ptr before each use. In other words, if
crypt() is used to encrypt several files, crypt_ptr
should be reset to zero before each is encrypted. Also
note the encryption is perfectly reversible - to decrypt
data, pass it back through crypt() using the original
key and original initial value of crypt_ptr.
*/

/**** Encrypt/decrypt buffer datum ******************************/
void crypt(char *buf)
{
*buf ^= cryptext[crypt_ptr] ^ (cryptext[0] * crypt_ptr);
cryptext[crypt_ptr] += ((crypt_ptr < (crypt_length - 1)) ?
cryptext[crypt_ptr + 1] : cryptext[0]);
if (!cryptext[crypt_ptr])
cryptext[crypt_ptr] += 1;
if (++crypt_ptr >= crypt_length)
crypt_ptr = 0;
}


  3 Responses to “Category : C Source Code
Archive   : CRYPT.ZIP
Filename : CRYPT.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/