2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/GlobalIncs/crypt.cpp $
15 * Files for cypting stuff
18 * Revision 1.3 2002/06/09 04:41:17 relnev
19 * added copyright header
21 * Revision 1.2 2002/05/07 03:16:45 theoddone33
22 * The Great Newline Fix
24 * Revision 1.1.1.1 2002/05/03 03:28:09 root
28 * 2 10/07/98 10:52a Dave
31 * 1 10/07/98 10:48a Dave
33 * 2 3/30/98 9:33p Allender
34 * string encryption stuff for cheat codes
42 char *jcrypt (char *plainstring)
45 static char cryptstring[CRYPT_STRING_LENGTH + 1];
47 len=strlen (plainstring);
48 if (len > CRYPT_STRING_LENGTH)
49 len = CRYPT_STRING_LENGTH;
51 for (i = 0;i < len; i++) {
54 for (t = 0; t < len; t++) {
55 cryptstring[i]^=(plainstring[t] ^ plainstring[i%(t+1)]);
62 return ((char *)cryptstring);