Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
packfile_password(3)		Allegro	manual		  packfile_password(3)

       packfile_password  -  Sets  the global I/O encryption password. Allegro
       game programming	library.

       #include	<allegro.h>

       void packfile_password(const char *password);

       Sets the	encryption password to be used for all	read/write  operations
       on  files  opened in future using Allegro's packfile functions (whether
       they are	compressed or not), including all the save,  load  and	config
       routines.  Files	written	with an	encryption password cannot be read un-
       less the	same password is selected, so be careful: if  you  forget  the
       key,  nobody  can make your data	come back again! Pass NULL or an empty
       string to return	to the normal, non-encrypted mode. If  you  are	 using
       this  function  to  prevent people getting access to your datafiles, be
       careful not to store an obvious copy  of	 the  password	in  your  exe-
       cutable:	 if  there  are	 any  strings  like  "I'm the password for the
       datafile", it would be fairly easy to get access	to your	data :-)

       Note #1:	when writing a packfile, you can change	the password to	 what-
       ever you	want after opening the file, without affecting the write oper-
       ation.  On the contrary,	when writing a sub-chunk of  a	packfile,  you
       must  make  sure	that the password that was active at the time the sub-
       chunk was opened	is still active	before closing the sub-chunk. This  is
       guaranteed  to  be true if you didn't call the packfile_password() rou-
       tine in the meantime. Read operations,  either  on  packfiles  or  sub-
       chunks, have no such restriction.

       Note  #2:  as  explained	above, the password is used for	all read/write
       operations on files, including for several  functions  of  the  library
       that   operate  on  files  without  explicitly  using  packfiles	 (e.g.
       load_bitmap()).	The unencrypted	mode is	mandatory in order  for	 those
       functions  to work.  Therefore remember to call packfile_password(NULL)
       before using them if you	previously changed the password. As a rule  of
       thumb, always call packfile_password(NULL) when you are done with oper-
       ations on packfiles.  The only exception	to this	 is  custom  packfiles
       created with pack_fopen_vtable().

       pack_fopen(3), load_datafile(3),	pack_fopen_vtable(3)

Allegro				 version 4.4.3		  packfile_password(3)


Want to link to this manual page? Use this URL:

home | help