Thread: archive format

  1. #1
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001

    archive format

    any suggestions.
    ;TODO: run spell check
    class cArchiveSystem
            develop a system to combine multible files into a single file and give the user verious options including
            compression and encryption.
            First started this project to provide a storage system type api. truefully i was board.
            This class is that system. I'm re-writing most of the code to make it more manageable and 64bit compatable
            also trying to figure a writing style which is easy to understand.
            ARCHIVE FILES - Each archive contains 2 files. "*.idx" and "*.arc"
                *.idx - archive index. this file contains a list of IDX_ENTRYs. including but not limited
                        to the file name, file length, and offset in the *.arc file.
                        a checksum of itself and its matching arc file.
                *.arc - archive file. this file contains the raw data of all files contained in the archive
            For max security one file is worthless without the other. Only when both files are avaible can the archive
            be opened.
            The system run in 1 of 3 modes.
                Note: when i talk about pad/padded i mean a random number of random bytes.
            SECURITY MODS    
                mod 1:  no security.
                    The idx file can be opened in notepad and plaintext, such as file names, read.
                    Files are stored on the *.arc file one after another.
                mod 2:  minimum security.
                    1. The idx file is encripted with a user provided key.
                    2. The idx file is padded at the start.
                    3. The arc file is encripted with the same user key as above.
                    4. The arc file is padded at both the start and end of file.
                    5. Each file stored in the arc file is seperated using a pad.
                mod 3: maximum security.
                    1-4 of mod 2.
                    5. Each file stored in the arc file is encrypted with a random key stored in the idx file.
                        A different key per file.                    
                    6. Each --encrypted file-- is broken into user defined size blocks. the last 4 bytes of each
                        block contain the offset to the next block. The blocks from different files are mixed at 
                    7. Each block is sepreated by a pad of random bytes.
          IDX file format.
            [1pad][2"\nidx"][3length][4IDX_ENTRYs][5checksum_this][6checksum_arc][7extra data][8pad]
            1. a random number of random bits not containing "\nidx".
                This pad my not exist in a given archive. see security mods
                This pad should be no longer that 100 bytes. -subject to change
            2. a static head required to id the file type and verify a correct key.
            3. number of IDX_ENTRYs in the file.
            4. IDX_ENTRYs
            5. some type of checksum/hash/message digest of the idx file.
            6. checksum of the arc file for this archive.
            7. extra data, keys and anything else I need.
            8. same as 1. 
            NOTE: 5. fill a buffer with 3,4,6,7,8. hash that value.
                  6 is the hash of the file before encryption.
                  7.extra data [1length][2data]...
                     1. length of data in bytes. unsigned char length. 1-256
                     2. data
          ARC file format.
            [pad][1"arc"][2pad][3FILE_BLOCK][pad] [FILE_BLOCK][pad]... [pad][4checksum]
            [pad] - randum number of random bytes
            1. static header
            2. a random pad of random bytes. the first 2 high order bits, flag which 
                security mode the file is saved in.
                    unsigned char x;            
                    x >>= 6;         
            3. raw file data. the last 4 bytes are the offset to the next block for this file.
                block size is user defined and stored in the idx file.
            4. a checksum of the file before encryption.
    Last edited by Nor; 08-05-2003 at 08:03 PM.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GradeInfo
    By kirksson in forum C Programming
    Replies: 23
    Last Post: 07-16-2008, 04:27 PM
  2. function returning hour in either 12 or 24 hour format
    By stanlvw in forum C Programming
    Replies: 4
    Last Post: 01-01-2008, 06:02 AM
  3. Compression/Decompression Wave File and MP3
    By cindy_16051988 in forum Projects and Job Recruitment
    Replies: 51
    Last Post: 04-29-2006, 07:25 AM
  4. A Better Format Simulator
    By toonlover in forum C++ Programming
    Replies: 2
    Last Post: 01-07-2006, 06:14 PM
  5. Seeking Format Advice
    By PsychoBrat in forum Game Programming
    Replies: 3
    Last Post: 10-05-2005, 06:41 AM
Website Security Test