#include #include #include //Import our code #include "decrypt.h" #include "fileReader.h" #include "utils/min.h" int main(int argc, unsigned char *argv[]) { printf("Hello World!\n"); //TODO: verify argv and assign it to variables char* archiveName = "1234"; const unsigned long archiveOffset = 0UL; const unsigned long fileLength = 0xffffUL; uint32_t key0 = 0; uint32_t key1 = 0; uint32_t key2 = 0; //Initialise file reader initFileReader(archiveName, archiveOffset); //Skip header (30 bytes + additional length) char* fileHeader = getBytes(30UL); printf(fileHeader); //TODO: check that header is correct //TODO: read additional length const unsigned long additionalLength = 0UL; getBytes(additionalLength); //Initialise decryption (pass decryption keys) initDecryptor(key0, key1, key2); //Skip 12-byte encryption header const unsigned long encrHeaderLength = 12UL; char* encrHeader = getBytes(encrHeaderLength); decrypt(encrHeader, encrHeaderLength); //Read actual file unsigned long remainingBytes = fileLength; while (remainingBytes > 0) { const unsigned long chunkSize = min(0xFF, remainingBytes); char* chunk = getBytes(chunkSize); remainingBytes -= chunkSize; decrypt(chunk, chunkSize); //Decompress file //TODO //Optionally perform xdelta3 //TODO } return 0; }