ArduinoDES icon indicating copy to clipboard operation
ArduinoDES copied to clipboard

How to encrypt String?

Open EuphoriaCelestial opened this issue 5 years ago • 1 comments

I ran the example code inside the folder. It worked well, but only able to encrypt natural number from 0 to 255, any number bigger will result incorrect, and most of all, I cant encrypt String type. I tried to change data type of input, output array to String and else, but none is work. Anyone still here to help?

EuphoriaCelestial avatar Mar 30 '19 15:03 EuphoriaCelestial

To encrypt and decrypt String, I made helper functions using String.getBytes() method `void StringToHexArray(String input, byte * target, int length) { input.getBytes(target, length + 1);//extra length for terminating character }

String HexArrayToString(int length) { String output = ""; for (int i = 0; i < length; i++) { output += String((char)out[i]); } return output; }`

ammarshahid572 avatar Jul 19 '22 07:07 ammarshahid572