Commit d20a06b4 authored by Arduino Enigma's avatar Arduino Enigma

Update CipherSaber.ino

parent ce64b224
......@@ -49,6 +49,7 @@ struct MenuData_t
byte IVRead = 0;
byte Hex[2];
byte HexRead = 0;
byte DecodeAsHex = 0;
} MenuData;
......@@ -491,7 +492,7 @@ void DoMenu()
{
case 0:
{
Serial.print(F("(D)ecrypt or (E)ncrypt?: "));
Serial.print(F("(D)ecrypt as HEX, (d)ecrypt as ASCII or (E)ncrypt?: "));
MenuData.ExitCount = 0;
MenuData.State = 1;
......@@ -514,9 +515,19 @@ void DoMenu()
if ((key | 32) == 'd')
{
Serial.print(F("D\x0a\x0d"));
Serial.print((char)key);
Serial.print(F("\x0a\x0d"));
MenuData.SkipNewline = 1;
if (key == 'd')
{
MenuData.DecodeAsHex = 0;
}
else
{
MenuData.DecodeAsHex = 1;
}
MenuData.NextState = 6;
MenuData.State = 2;
}
......@@ -639,12 +650,31 @@ void DoMenu()
}
else
{
Serial.print((char)ARCFOUREncrypt(HexToByte(MenuData.Hex)));
MenuData.PrintCount++;
if (MenuData.PrintCount == 40)
if (MenuData.DecodeAsHex == 0)
{
Serial.print((char)ARCFOUREncrypt(HexToByte(MenuData.Hex)));
if (MenuData.PrintCount > 40)
{
MenuData.PrintCount = 0;
Serial.print(F("\x0a\x0d"));
}
}
else
{
Serial.print(F("\x0a\x0d"));
PrintHex(ARCFOUREncrypt(HexToByte(MenuData.Hex)));
if (MenuData.PrintCount > 20)
{
MenuData.PrintCount = 0;
Serial.print(F("\x0a\0x0d"));
}
else
{
Serial.print(F(" "));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment