home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c222 / 1.ddi / SOURCE / CLIB / UT_CRYPT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-10  |  599 b   |  32 lines

  1. /*********************
  2.  *
  3.  *  ut_crypt.c - data encryption functions.
  4.  *
  5.  *  Purpose: This file contains an encryption routine for single byte
  6.  *           encoding and decoding of data.
  7.  *
  8.  *  Blackstar C Function Library
  9.  *  (c) Copyright 1985,1989 Sterling Castle Software
  10.  *
  11.  *******/
  12.  
  13. #include "blackstr.h"
  14.  
  15.  
  16. /********
  17.  *
  18.  *   ut_crypt(buff,key,nbytes) - encrypt buffer of nbytes using key
  19.  *
  20.  **/
  21.  
  22. void ut_crypt(char *buff, char key, int nbytes)
  23. {
  24.     int i;
  25.  
  26.     for (i=0; i<nbytes; ++i) {
  27.     if(*buff)
  28.         *buff^= key;    /* use bitwise xor */
  29.     ++buff;
  30.     }
  31. }
  32.