1packfile_password(3) Allegro manual packfile_password(3)
2
3
4
6 packfile_password - Sets the global I/O encryption password. Allegro
7 game programming library.
8
10 #include <allegro.h>
11
12
13 void packfile_password(const char *password);
14
16 Sets the encryption password to be used for all read/write operations
17 on files opened in future using Allegro's packfile functions (whether
18 they are compressed or not), including all the save, load and config
19 routines. Files written with an encryption password cannot be read
20 unless the same password is selected, so be careful: if you forget the
21 key, nobody can make your data come back again! Pass NULL or an empty
22 string to return to the normal, non-encrypted mode. If you are using
23 this function to prevent people getting access to your datafiles, be
24 careful not to store an obvious copy of the password in your exe‐
25 cutable: if there are any strings like "I'm the password for the
26 datafile", it would be fairly easy to get access to your data :-)
27
28 Note #1: when writing a packfile, you can change the password to what‐
29 ever you want after opening the file, without affecting the write oper‐
30 ation. On the contrary, when writing a sub-chunk of a packfile, you
31 must make sure that the password that was active at the time the sub-
32 chunk was opened is still active before closing the sub-chunk. This is
33 guaranteed to be true if you didn't call the packfile_password() rou‐
34 tine in the meantime. Read operations, either on packfiles or sub-
35 chunks, have no such restriction.
36
37 Note #2: as explained above, the password is used for all read/write
38 operations on files, including for several functions of the library
39 that operate on files without explicitly using packfiles (e.g.
40 load_bitmap()). The unencrypted mode is mandatory in order for those
41 functions to work. Therefore remember to call packfile_password(NULL)
42 before using them if you previously changed the password. As a rule of
43 thumb, always call packfile_password(NULL) when you are done with oper‐
44 ations on packfiles. The only exception to this is custom packfiles
45 created with pack_fopen_vtable().
46
47
49 pack_fopen(3), load_datafile(3), pack_fopen_vtable(3)
50
51
52
53Allegro version 4.2.2 packfile_password(3)