home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / GameSmith1-Hisoft-System.DMS / in.adf / GDS_System.lha / cydec.doc < prev    next >
Encoding:
Text File  |  1995-01-17  |  3.7 KB  |  78 lines

  1. Welcome to the incredibly flexible Cydec module!  With it you will be able
  2. to encrypt/decrypt IFF graphics and sound files using YOUR OWN ENCRYPTION
  3. ALGORITHMS!  You may even decide to come up with multiple encryption types.
  4. Or you can opt to simply use the method supplied in the cydec.c file.  The
  5. key to this operation is that the loadILBM and load_iff_sound functions
  6. call the cydec module to identify encryption techniques, and, if identified,
  7. call your decrytion function when reading data.  All you need do to make
  8. this work is simply link your programs with the cydec.o module.  However,
  9. for unencrypted applications, you need not link with this module, as the stub
  10. functions supplied in the library will simply not recognize any encryption
  11. techniques.  Also supplied are the programs gs_cypher and gs_decypher.  As
  12. you probably guessed, these programs allow you to encrypt or decrypt files.
  13. They automatically recognize ILBM graphics files and 8SVX sound files.
  14. The encryption program gs_cypher calls the cydec module for an ID to be used
  15. with the file, then calls your encryption function when rewriting the data.
  16. Since the resultant file is rewritten (via a temporary file while writing) and
  17. the original version destroyed, you can decrypt it with the gs_decypher
  18. program.  This will restore the file to it's original form.  If you change the
  19. cydec.c module (or write an equivelent assembler module), you'll need to
  20. relink gs_cypher.obj and gs_decypher.obj to recreate these programs.
  21.  
  22.  
  23. FILE TYPES:
  24.  
  25.    IFF ILBM = 0
  26.    IFF 8SVX = 1
  27.  
  28.  
  29. ENCRYPTION PROCESS:
  30.  
  31.    1) gs_cypher calls gs_cypher_block with the file type to get an encryption
  32.       header.  Make sure this is unique, as this header is used to identify
  33.       your encryption method.  The header may be any length up to 4096 bytes.
  34.       This call is the key to resetting and selecting the encryption algorithm.
  35.       Subsequent calls to the encryption function must assume that the proper
  36.       encryption algorithm is the one selected with the last call to
  37.       gs_cypher_block.
  38.    2) While rewriting the data file, gs_cypher calls gs_encrypt_data to
  39.       process the data before writing it back out.
  40.  
  41.  
  42. DECRYPTION PROCESS:
  43.  
  44.    1) The loadILBM function or the load_iff_sound function calls
  45.       gs_identify_cypher with the header found in the file, and its length.
  46.       If your program recognizes the header, then subsequent calls to the
  47.       decryption function must assume this decryption algorithm.  Again,
  48.       when gs_identify_cypher is called, this is your key to reset the
  49.       algorithm.
  50.    2) The loadILBM function or the load_iff_sound function calls
  51.       gs_decrypt_data if the encryption method was properly identified.
  52.  
  53.  
  54. THE LINK PROCESS (examples):
  55.  
  56.    execute the cypher.link script provided in the GameSmith directory to
  57.    rebuild the gs_cypher and gs_decypher programs.  See notes in the script
  58.    itself for linking with a compiler or assembler system other than SAS.
  59.  
  60.    slink lib:c.o myprogram.o cydec.o lib lib:sc.lib,GameSmith:GameSmith.lib
  61.  
  62.  
  63. HINTS:
  64.  
  65. Even if you don't want to change the algorithm, change the header string
  66. slightly in the cydec.c module.  This will make your encrypted files your own.
  67. Nobody else will be able to use them.  Remember to relink with gs_cypher.obj
  68. and gs_decypher.obj before encrypting you files!
  69.  
  70. If you change the encryption algorithm intended for sound files, test out the
  71. encrypted version using the SND program supplied on the example disk (without
  72. relinking it to recognize your encryption method).  It should sound nothing
  73. like the original file (like the default encryption method will do).
  74.  
  75. WARNING!  *NEVER* change the cydec_proto.h file.  The cydec functions will
  76. always be called in the same manner by loadILBM, load_iff_sound, gs_cypher,
  77. and gs_decypher.
  78.