arduino-code problem mit 3des encypt entschlüsseln
Hallo ich habe ein problem mit meinem code in 3des enc/dec-es funktioniert mit nur 8 byte für mich
ich habe nur dieses Ergebnis
B1-09 DA-E1 B7 1B 63 8E 17 02 07 83 1A 0D 1A DF 36 1F E4 6D 41 28 35 25 02 00 00 14 00 00 43 77 3B 38 98 37 15 20 F7 0C 18 56 03 00 00 14 00 00
unten füge ich meinen Beispiel-code
#include <DES.h>
DES des;
void setup() {
Serial.begin(9600);
Serial.println("Hello!");
}
void loop() {
tdesTest();
delay(2000);
}
void tdesTest()
{
byte out[48];
byte in[48] = { 0xda, 0x9f, 0xab, 0xbe, 0x85, 0x26, 0x6f, 0x53, 0x9c, 0x8c, 0xbb, 0x03, 0x7f, 0x54, 0x61, 0x27, 0x3d, 0xfa, 0xb9, 0xf5, 0xfe, 0xb0, 0x9a, 0x3b, 0x3b, 0xc6, 0xf8, 0xb5, 0xe0, 0x84, 0x4d, 0xe1, 0x58, 0xe7, 0x88, 0x83, 0xae, 0x0d, 0xae, 0xdf, 0x36, 0x0d, 0xd0, 0x68, 0x45, 0x2b, 0x37, 0x24 };
byte key[] = {
0x15, 0x2b, 0xd8, 0x96, 0x57, 0xe0, 0x3f, 0xdc,
0x73, 0x75, 0xa0, 0x0e, 0x1f, 0xb1, 0xa3, 0x8b,
0xab, 0x09, 0x7c, 0x10, 0x3b, 0x80, 0x38, 0x46,
};
Serial.println();
Serial.println("====== Triple-DES test ======");
//encrypt
Serial.print("Encrypt...");
unsigned long time = micros();
des.tripleEncrypt(out, in, key);
time = micros() - time;
Serial.print("done. (");
Serial.print(time);
Serial.println(" micros)");
printArray(out);
//decrypt
for (int i = 0; i < 48; i++)
{
in[i] = out[i];
}
Serial.print("Decrypt...");
time = micros();
des.tripleDecrypt(out, in, key);
time = micros() - time;
Serial.print("done. (");
Serial.print(time);
Serial.println(" micros)");
printArray(out);
}
void printArray(byte output[])
{
for (int i = 0; i < 48; i++)
{
if (output[i] < 0x10)
{
Serial.print("0");
}
Serial.print(output[i], HEX);
Serial.print(" ");
}
Serial.println();
}