I'm trying to encrypt a string in my Arduino Uno using the following library:
https://github.com/rweather/arduinolibs/tree/master/libraries/Crypto
And I'm getting this error:
In function 'void setup()':
TESTING_SPECK_LIB:27: error: request for member 'setKey' in '(byte)(& cipher)', which is of non-class type 'byte {aka unsigned char}'
cipher->setKey(*key,keySize);
exit status 1 request for member 'setKey' in '(byte)(& cipher)', which is of non-class type 'byte {aka unsigned char}'
This is the code I'm using:
#include <Crypto.h>
#include <Speck.h>
#include <SpeckSmall.h>
#include <SpeckTiny.h>
#include <string.h>
Speck speck;
SpeckSmall speckSmall;
SpeckTiny speckTiny;
byte buffer[16];
byte cipher[16];
size_t keySize = 32;
void setup() {
const uint8_t key[32]={0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00};
byte plaintext[16]={0x6c, 0x61, 0x76, 0x69, 0x75, 0x71, 0x65, 0x20,
0x74, 0x69, 0x20, 0x65, 0x64, 0x61, 0x6d, 0x20};
byte ciphertext[16]={0xa6, 0x5d, 0x98, 0x51, 0x79, 0x78, 0x32, 0x65,
0x78, 0x60, 0xfe, 0xdf, 0x5c, 0x57, 0x0d, 0x18};
Serial.begin(9600);
cipher->setKey(*key,keySize);
cipher->encryptBlock(buffer, plaintext);
}
void loop() {
}
I know that I'm doing something wrong, but I don't understand what the error means, someone knows what it means and how to fix it?