مرحبااا
لو سمحتوووووا أريدكم تساعدووني ف كتابة هالبرنااامج بليييييييييييز ضروووري وبأسرع وقت ممكن لو تكرمتووووا
Question :
In many applications one may need to encrypt data for storage or transmission. XTEA is a simple but powerful encryption algorithm that can be used in many embedded systems. The
algorithm operates on 64 bit blocks (i.e. two 32-bit words). It takes a 64-bit block (plain text) and 128 bit key to produce a 64-bit result (cipher text).
Modify your design to include encryption using XTEA. Select a secret message and a secret key, encrypt the message and save the result in the SD-card as a file.
#include <string.h>
#include "lpc214x.h"
#include "lpc_config.h"
#include "uart.h"
#include "efs.h"
#include "ls.h"
#include "mkfs.h"
#include "interfaces/efsl_dbg_printf_arm.h"
#define rprintf efsl_debug_printf_arm
#define BAUD 115200
//#define BIT(x) ((unsigned long)1<<x)
EmbeddedFileSystem efs;
EmbeddedFile filer, filew;
DirList list;
unsigned short e;
unsigned char buf[513];
unsigned char buffer [513];
int main(void)
{
int i, n;
int8_t res;
Initialize();
uart0Init(UART_BAUD(BAUD), UART_8N1, UART_FIFO_8); // setup the UART
/* init efsl debug-output */
efsl_debug_devopen_arm(uart0Putch);
rprintf("SD Card Testing for ECCE5223 \r\n");
rprintf("CARD init...");
//initialize the file system library
res = efs_init(&efs, 0);
if(res!=0)
rprintf("failed with %i\n", res);
//create a file.
res = file_fopen(&filew, &efs.myFs, "project2.html", 'w');
if(res!=0)
rprintf("failed to open file %i\n", res);
strcpy((char *) buf, "Hello \r\n");
for(i=0; i<5; i++){
n = file_write(&filew, strlen((char *) buf), buf);
if(n == strlen((char *) buf))
rprintf("All data in buffer written\r\n");
else
rprintf("Not all data in buffer written\r\n");
}
// close the file and unmount the card
file_fclose(&filew);
fs_umount(&efs.myFs);
rprintf("done.\r\n");
res = file_fopen(&filer, &efs.myFs, "project2.html", 'r');
if(res!=0)
rprintf("failed to open file %i\n", res);
else
{
file_read(&filer,513,buffer);
rprintf(buffer);
}
while(1)
;
return 0; /* never reached */}

