Hi my friend,
I'm newbie for arduino programming. I am trying for encrytion some string with xor algorithm. But when i uploaded my to arduino and after then open serial monitor i see nothing happen.
I don't find my problem where it is.
This is my code. I found it one website :
#include <SD.h>
void setup()
{
String str, encrypted, decrypted;
str ="write_anything";
encrypted = XOREncryption(str, 12); // storing the encrypted string
decrypted = XORDecryption(encrypted, 12);
Serial.println(encrypted);
}
String XOREncryption(String str, int key)
{
String enc("");
for (unsigned int i(0); i < str.length(); i++) // iterates through the string to encrypt
enc += str ^ key; // ^ - XOR operator in C++
- return enc;*
}
String XORDecryption(String str, int key)
{ - String dec("");*
for (unsigned int i(0); i < str.length(); i++)// iterates through the string to decrypt
_ dec += str ^ key; // ^ - XOR operator in C++_
* return dec;*
}
void loop()
{
}
Thanks for your attention.
Best regards.