-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate encrypt/decrypt #5
Comments
@ajitam Hi! Thank you again for your support and betatest. I this week end and today worked to release a new stable version with a different and more secure encryption method. After various tests I decided to get rid of iterations, to save computation time (because of multiple function call). I ended up with a 3 step non-iteration-tunable encryption vastly based on private key and data hashing. I also used your example to doublecheck its correct functionality: #include <Cape.h>
Cape cape("oEpHgSPFvZ6TzrzkaKMX", 20);
#define DO_ENCRYPT 1
#define DO_DECRYPT 1
void setup() {
Serial.begin(115200);
}
void loop() {
#if DO_ENCRYPT
char in[] = {10, 10};
cape.encrypt(in, 2);
byte enPacket_1 = cape.result[0];
byte enPacket_2 = cape.result[1];
byte enPacket_3 = cape.result[2];
Serial.print(enPacket_1);
Serial.print(" | ");
Serial.print(enPacket_2);
Serial.print(" | ");
Serial.println(enPacket_3);
delay(1000);
#endif
#if DO_DECRYPT
char out[] = {enPacket_1, enPacket_2, enPacket_3};
// From static crypted string back to 10, 10
//char out[] = {108, 65, 13};
cape.decrypt(out, 3);
byte dePacket_1 = cape.result[0];
byte dePacket_2 = cape.result[1];
Serial.print(dePacket_1);
Serial.print(" | ");
Serial.println(dePacket_2);
delay(1000);
#endif
} Changelog:
I am sorry for the temporary instability of the code. |
Is this new encryption based on some other method? (previous one was similar to RC4) |
Hi @ajitam. I would not indicate any method in particular as "inspiration" for this. Other users complained because RC4 is holed like Emmenthal, so I decided to work on a new, dedicated method based on standard and proved effective methods to encrypt a string. |
@ajitam I tried to be as clear as possible in the code's comments. |
I'm not an expert in cryptology so frankly - I don't know which method is better and what are there flaws.
(closing this issue - sorry I didn't do it earlier) |
Hi, so I continue my work using you script and I hit a problem. I'm not 100% this is an issue, because the logic changed and I'm still trying to wrap my head around the code. So here we go:
I prepared a simple script which:
encrypts 2bytes (
0xAA 0xEE
)uses 10 iterations
Steps
If I set
DO_ENCRYPT 1
andDO_DECRYPT 1
I get thiswhich is correct.
Then I set set
DO_ENCRYPT 1
andDO_DECRYPT 0
and I get thisI then:
char out[]
with this values like sochar out[] = {0xAB, 0x80, 0x59};
DO_ENCRYPT 0
andDO_DECRYPT 1
and I get this
Problem
Any ideas why data is not decrypted to the same value. As far I understand 3th byte is initialization byte which just "mangles" data.
The text was updated successfully, but these errors were encountered: