Debian Codegraph @

terps/tads/tads2/fioxor.c

raw symbols SCIP
1 #ifdef RCSID
2 static char RCSid[] =
3 "$Header: d:/cvsroot/tads/TADS2/FIOXOR.C,v 1.2 1999/05/17 02:52:12 MJRoberts Exp $";
4 #endif
5
6 /*
7 * Copyright (c) 1992, 2002 Michael J. Roberts. All Rights Reserved.
8 *
9 * Please see the accompanying license file, LICENSE.TXT, for information
10 * on using and copying this software.
11 */
12 /*
13 Name
14 fioxor.c - file i/o encryption (XOR) routine
15 Function
16 Encrypts/decrypts a block of memory using a simple function that
17 generates a stream of pseudo-random characters and xors them with
18 a data block. Used to hide the data within a game object. This
19 is a terribly insecure code, intended only to slow down would-be
20 prying eyes. Fortunately, it isn't obvious what the plaintext is,
21 so the simplicity of the encryption algorithm should be offset
22 somewhat by the obscurity of the unencrypted data.
23 Notes
24 None
25 Modified
26 03/13/93 MJRoberts - parameterize encryption scheme
27 04/16/92 MJRoberts - creation
28 */
29
30 #include "os.h"
31 #include "std.h"
32 #include "fio.h"
33
34 void fioxor(uchar *p, uint siz, uint seed, uint inc)
35 {
36 for ( ; siz ; seed += inc, --siz)
37 *p++ ^= (uchar)seed;
38 }