1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
/* My Code
1- Inicial Key vector = 0x00,0x00,0x00,0x00,0xAA,0xBB,0xCC,0xDD
2- Digit values for AUX_[0]=10, AUX_[1]=20, AUX_[2]=30, AUX_[3]=40,
3- Final Key vector = 0x10,0x20,0x30,0x40,0xAA,0xBB,0xCC,0xDD
*/
#include <cstring>
#include <cstdlib>
#include <cstdio>
typedef unsigned char byte;
byte KEY_[8] = {0x00,0x00,0x00,0x00,0xAA,0xBB,0xCC,0xDD};
byte aux_[4];
int main( )
{
printf("Enter AUX Vector :\n");
for (int i= 0; i < 4; ++i)
{
scanf ("%X",&aux_[i]);
}
printf ("\n\n");
printf ("Vector AUX : %X %X %X %X \n", aux_[0], aux_[1], aux_[2], aux_[3]);
for (int i= 0; i < 4; ++i)
{
KEY_[i]=KEY_[i]^aux_[i];
}
printf ("\nFinal Vector Key :");
for (int i= 0; i < 8; ++i)
{
printf ("%02X", KEY_[i]);
}
printf ("\n\n");
system("pause");
return(0);
}
|