home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -seriously_amiga- / archivers / arcppc / src / rcs / arccode.c,v < prev    next >
Text File  |  1998-04-23  |  1KB  |  69 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    hyc:1.1; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     88.06.01.15.15.58;  author hyc;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @/*
  26.  * $Header: arccode.c,v 1.3 88/04/19 01:39:24 hyc Exp $
  27.  */
  28.  
  29. /*
  30.  * ARC - Archive utility - ARCCODE
  31.  * 
  32.  * Version 1.02, created on 01/20/86 at 13:33:35
  33.  * 
  34.  * (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
  35.  * 
  36.  * By:  Thom Henderson
  37.  * 
  38.  * Description: This file contains the routines used to encrypt and decrypt data
  39.  * in an archive.  The encryption method is nothing fancy, being just a
  40.  * routine XOR, but it is used on the packed data, and uses a variable length
  41.  * key.  The end result is something that is in theory crackable, but I'd
  42.  * hate to try it.  It should be more than sufficient for casual use.
  43.  * 
  44.  * Language: Computer Innovations Optimizing C86
  45.  */
  46. #include <stdio.h>
  47. #include "arc.h"
  48.  
  49. static char    *p;        /* password pointer */
  50.  
  51. void
  52. setcode()
  53. {                /* get set for encoding/decoding */
  54.     p = password;        /* reset password pointer */
  55. }
  56.  
  57. unsigned char
  58. code(c)                /* encode some character */
  59.     char            c;    /* character to encode */
  60. {
  61.     if (p) {        /* if password is in use */
  62.         if (!*p)    /* if we reached the end */
  63.             p = password;    /* then wrap back to the start */
  64.         return c ^ *p++;/* very simple here */
  65.     } else
  66.         return c;    /* else no encryption */
  67. }
  68. @
  69.