diff --git a/src/main.c b/src/main.c index 4d49883..11f883d 100644 --- a/src/main.c +++ b/src/main.c @@ -10,24 +10,34 @@ 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("1234", 0UL); + 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(0, 0, 0);//TODO + initDecryptor(key0, key1, key2); //Skip 12-byte encryption header - char* encryptionHeader = getBytes(12UL); - decrypt(encryptionHeader, 12); + const unsigned long encrHeaderLength = 12UL; + char* encrHeader = getBytes(encrHeaderLength); + decrypt(encrHeader, encrHeaderLength); //Read actual file - unsigned long remainingBytes = 0xFFFF;//TODO + unsigned long remainingBytes = fileLength; while (remainingBytes > 0) { const unsigned long chunkSize = min(0xFF, remainingBytes); char* chunk = getBytes(chunkSize);