user21332: I really want to understand how can I use this library for my purposes.
I'm trying to encrypt a message that comes through the serial port of the Arduino, and send it through another serial port. But I'm having issues understanding how to use the library.
I have read the documentation of the library, but I still get errors, I need a little help with this.
This is the code I have (without involving the serial ports), initially I wanted to check if I could define my strings and use them in another way instead of using the TestVector Function:
 #include <Crypto.h>
 #include <Speck.h>
 #include <SpeckSmall.h>
 #include <SpeckTiny.h>
 #include <string.h>

 struct EncryptText
 {
     const char *name;
     byte key[32];
     byte plaintext[16];
     byte ciphertext[16];
 };

 EncryptText test ;

   static TestCipher {

   test.name = "Speck-128-ECB";
   test.key = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00};
   test.plaintext = {0x6c, 0x61, 0x76, 0x69, 0x75, 0x71, 0x65, 0x20,
                     0x74, 0x69, 0x20, 0x65, 0x64, 0x61, 0x6d, 0x20};
  test.ciphertext = {0xa6, 0x5d, 0x98, 0x51, 0x79, 0x78, 0x32, 0x65,
                     0x78, 0x60, 0xfe, 0xdf, 0x5c, 0x57, 0x0d, 0x18};
   }

Speck speck;
SpeckSmall speckSmall;
SpeckTiny speckTiny;

byte buffer[16];

//void testCipher(BlockCipher *cipher, const struct TestVector *test, size_t keySize, bool decryption = true)
void testCipher(BlockCipher *cipher, size_t keySize, bool decryption = true)

{

    Serial.print(" Encryption ... ");
    cipher->setKey(key, keySize);
    cipher->encryptBlock(buffer, plaintext);

    for(byte b=0; b<16; b++)
   {
      Serial.print(buffer[b], HEX);
   }

    if (memcmp(buffer, ciphertext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");

    if (!decryption)
        return;


    Serial.print(" Decryption ... ");
    cipher->decryptBlock(buffer, ciphertext);

    for(byte b=0; b<16; b++)
   {
      Serial.print(buffer[b], HEX);
   }
    if (memcmp(buffer, plaintext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");
}

I'm getting the error: "exit status 1 'TestCipher' does not name a type"
EDIT: The full error that I get is:
 Speck_4-08-2017:27: error: 'TestCipher' does not name a type    static
 TestCipher {
           ^ Speck_4-08-2017.ino: In function 'void testCipher(BlockCipher*, size_t, bool)': Speck_4-08-2017:62: error:
 'key' was not declared in this scope
      cipher->setKey(key, keySize);
                     ^ Speck_4-08-2017:63: error: 'plaintext' was not declared in this scope
      cipher->encryptBlock(buffer, plaintext);
                                   ^ Speck_4-08-2017:70: error: 'ciphertext' was not declared in this scope
      if (memcmp(buffer, ciphertext, 16) == 0)
                         ^ Speck_4-08-2017:80: error: 'ciphertext' was not declared in this scope
      cipher->decryptBlock(buffer, ciphertext);
                                   ^ Speck_4-08-2017.ino: In function 'void perfCipher(BlockCipher*, const TestVector*, size_t, bool)':
 Speck_4-08-2017:104: error: 'key2' was not declared in this scope
          cipher->setKey(key2, keySize);
                         ^ Speck_4-08-2017.ino: In function 'void setup()': Speck_4-08-2017:158: error: 'testVectorSpeck128' was not
 declared in this scope
      testCipher(&speck, &testVectorSpeck128, 16);
                          ^ exit status 1 'TestCipher' does not name a type

Any guidance would be very helpful.

user11529: The first error looks like this
 Speck_4-08-2017:27: error: 'TestCipher' does not name a type    static
 TestCipher {

Further errors are basically all caused by that one wrongly written declaration. It could be fixed by declaring the first struct properly.
Compare this example code you have
struct TestVector
{
    const char *name;
    byte key[32];
    byte plaintext[16];
    byte ciphertext[16];
};

static TestVector const testVectorSpeck256 = {
    .name        = "Speck-256-ECB",
    .key         = {0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
                    0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
                    0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                    0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00},
    .plaintext   = {0x65, 0x73, 0x6f, 0x68, 0x74, 0x20, 0x6e, 0x49,
                    0x20, 0x2e, 0x72, 0x65, 0x6e, 0x6f, 0x6f, 0x70},
    .ciphertext  = {0x41, 0x09, 0x01, 0x04, 0x05, 0xc0, 0xf5, 0x3e,
                    0x4e, 0xee, 0xb4, 0x8d, 0x9c, 0x18, 0x8f, 0x43}
};

and your code  
struct EncryptText
 {
     const char *name;
     byte key[32];
     byte plaintext[16];
     byte ciphertext[16];
 };

 EncryptText test ;
   static TestCipher {

   test.name = "Speck-128-ECB";
   test.key = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00};
   test.plaintext = {0x6c, 0x61, 0x76, 0x69, 0x75, 0x71, 0x65, 0x20,
                     0x74, 0x69, 0x20, 0x65, 0x64, 0x61, 0x6d, 0x20};
  test.ciphertext = {0xa6, 0x5d, 0x98, 0x51, 0x79, 0x78, 0x32, 0x65,
                     0x78, 0x60, 0xfe, 0xdf, 0x5c, 0x57, 0x0d, 0x18};
   }

You wrote EncryptText test; by specifying the type EncryptText you defined before and a name test, but now, you can assign to test by just using test. + variable name and nothing else (no static TestCipher{}). Or you could use what the example does, it basically just skips the EncryptText test; part and puts it on one line, like static TestVector const testVectorSpeck128 = { and assigns inside the curly brackets just using . + variable name (without test or testVectorSpeck128). 
Now, the second error
 'key' was not declared in this scope
      cipher->setKey(key, keySize);

is that the variable key is not defined in the function testCipher just like the error says, you have to define that variable or use the right one, in the example it was done using a function parameter (you commented out) TestVector *test, it was dereferenced and accessed with test->key. I assume you've properly defined that struct now, there's no need to deal with pointers and with direct reference to the data you can use it elsewhere by just using something like this
cipher->setKey(test.key, keySize);

rest of the errors are of similar fashion and can be fixed by just adding test. like I showed. If you fix those errors rest should be simple already.
As you are just learning, take small steps modifying the examples and use the Verify button as often as possible, Arduino IDE also has a button to autoformat code, use it, makes your code more readable for you and everyone else.

user13425: It looks like you want to create a struct and initialize it. Like this:
struct EncryptText
{
    const char *name;
    byte key[32];
    byte plaintext[16];
    byte ciphertext[16];
};

EncryptText test = {
    "Speck-128-ECB",
    {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00},
    {0x6c, 0x61, 0x76, 0x69, 0x75, 0x71, 0x65, 0x20,
                     0x74, 0x69, 0x20, 0x65, 0x64, 0x61, 0x6d, 0x20},
    {0xa6, 0x5d, 0x98, 0x51, 0x79, 0x78, 0x32, 0x65,
                     0x78, 0x60, 0xfe, 0xdf, 0x5c, 0x57, 0x0d, 0x18}
};

Then it appears you want to use that object. Note that to access each member of the struct you have to use dot notation (ex: test.key):
void testCipher(BlockCipher *cipher, size_t keySize, bool decryption = true)
{
    Serial.print(" Encryption ... ");
    cipher->setKey(test.key, keySize);
    cipher->encryptBlock(buffer, test.plaintext);

    for(byte b=0; b<16; b++)
    {
        Serial.print(buffer[b], HEX);
    }

    if (memcmp(buffer, test.ciphertext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");

    if (!decryption)
        return;

    Serial.print(" Decryption ... ");
    cipher->decryptBlock(buffer, test.ciphertext);

    for(byte b=0; b<16; b++)
    {
        Serial.print(buffer[b], HEX);
    }
    if (memcmp(buffer, test.plaintext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");
}


21332: <p>I really want to understand how can I use this library for my purposes.</p>

<p>I'm trying to encrypt a message that comes through the serial port of the Arduino, and send it through another serial port. But I'm having issues understanding how to use the library.
I have read the documentation of the library, but I still get errors, I need a little help with this.</p>

<p>This is the code I have (without involving the serial ports), initially I wanted to check if I could define my strings and use them in another way instead of using the TestVector Function:</p>

<pre><code> #include &lt;Crypto.h&gt;
 #include &lt;Speck.h&gt;
 #include &lt;SpeckSmall.h&gt;
 #include &lt;SpeckTiny.h&gt;
 #include &lt;string.h&gt;

 struct EncryptText
 {
     const char *name;
     byte key[32];
     byte plaintext[16];
     byte ciphertext[16];
 };

 EncryptText test ;

   static TestCipher {

   test.name = "Speck-128-ECB";
   test.key = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00};
   test.plaintext = {0x6c, 0x61, 0x76, 0x69, 0x75, 0x71, 0x65, 0x20,
                     0x74, 0x69, 0x20, 0x65, 0x64, 0x61, 0x6d, 0x20};
  test.ciphertext = {0xa6, 0x5d, 0x98, 0x51, 0x79, 0x78, 0x32, 0x65,
                     0x78, 0x60, 0xfe, 0xdf, 0x5c, 0x57, 0x0d, 0x18};
   }

Speck speck;
SpeckSmall speckSmall;
SpeckTiny speckTiny;

byte buffer[16];

//void testCipher(BlockCipher *cipher, const struct TestVector *test, size_t keySize, bool decryption = true)
void testCipher(BlockCipher *cipher, size_t keySize, bool decryption = true)

{

    Serial.print(" Encryption ... ");
    cipher-&gt;setKey(key, keySize);
    cipher-&gt;encryptBlock(buffer, plaintext);

    for(byte b=0; b&lt;16; b++)
   {
      Serial.print(buffer[b], HEX);
   }

    if (memcmp(buffer, ciphertext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");

    if (!decryption)
        return;


    Serial.print(" Decryption ... ");
    cipher-&gt;decryptBlock(buffer, ciphertext);

    for(byte b=0; b&lt;16; b++)
   {
      Serial.print(buffer[b], HEX);
   }
    if (memcmp(buffer, plaintext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");
}
</code></pre>

<p>I'm getting the error: "exit status 1 'TestCipher' does not name a type"</p>

<p>EDIT: The full error that I get is:</p>

<pre><code> Speck_4-08-2017:27: error: 'TestCipher' does not name a type    static
 TestCipher {
           ^ Speck_4-08-2017.ino: In function 'void testCipher(BlockCipher*, size_t, bool)': Speck_4-08-2017:62: error:
 'key' was not declared in this scope
      cipher-&gt;setKey(key, keySize);
                     ^ Speck_4-08-2017:63: error: 'plaintext' was not declared in this scope
      cipher-&gt;encryptBlock(buffer, plaintext);
                                   ^ Speck_4-08-2017:70: error: 'ciphertext' was not declared in this scope
      if (memcmp(buffer, ciphertext, 16) == 0)
                         ^ Speck_4-08-2017:80: error: 'ciphertext' was not declared in this scope
      cipher-&gt;decryptBlock(buffer, ciphertext);
                                   ^ Speck_4-08-2017.ino: In function 'void perfCipher(BlockCipher*, const TestVector*, size_t, bool)':
 Speck_4-08-2017:104: error: 'key2' was not declared in this scope
          cipher-&gt;setKey(key2, keySize);
                         ^ Speck_4-08-2017.ino: In function 'void setup()': Speck_4-08-2017:158: error: 'testVectorSpeck128' was not
 declared in this scope
      testCipher(&amp;speck, &amp;testVectorSpeck128, 16);
                          ^ exit status 1 'TestCipher' does not name a type
</code></pre>

<p>Any guidance would be very helpful.</p>
 11529: <p>The first error looks like this</p>

<pre><code> Speck_4-08-2017:27: error: 'TestCipher' does not name a type    static
 TestCipher {
</code></pre>

<p>Further errors are basically all caused by that one wrongly written declaration. It could be fixed by declaring the first struct properly.<br>
Compare this example code you have</p>

<pre><code>struct TestVector
{
    const char *name;
    byte key[32];
    byte plaintext[16];
    byte ciphertext[16];
};

static TestVector const testVectorSpeck256 = {
    .name        = "Speck-256-ECB",
    .key         = {0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
                    0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
                    0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                    0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00},
    .plaintext   = {0x65, 0x73, 0x6f, 0x68, 0x74, 0x20, 0x6e, 0x49,
                    0x20, 0x2e, 0x72, 0x65, 0x6e, 0x6f, 0x6f, 0x70},
    .ciphertext  = {0x41, 0x09, 0x01, 0x04, 0x05, 0xc0, 0xf5, 0x3e,
                    0x4e, 0xee, 0xb4, 0x8d, 0x9c, 0x18, 0x8f, 0x43}
};
</code></pre>

<p>and your code  </p>

<pre><code>struct EncryptText
 {
     const char *name;
     byte key[32];
     byte plaintext[16];
     byte ciphertext[16];
 };

 EncryptText test ;
   static TestCipher {

   test.name = "Speck-128-ECB";
   test.key = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00};
   test.plaintext = {0x6c, 0x61, 0x76, 0x69, 0x75, 0x71, 0x65, 0x20,
                     0x74, 0x69, 0x20, 0x65, 0x64, 0x61, 0x6d, 0x20};
  test.ciphertext = {0xa6, 0x5d, 0x98, 0x51, 0x79, 0x78, 0x32, 0x65,
                     0x78, 0x60, 0xfe, 0xdf, 0x5c, 0x57, 0x0d, 0x18};
   }
</code></pre>

<p>You wrote <code>EncryptText test;</code> by specifying the type <code>EncryptText</code> you defined before and a name <code>test</code>, but now, you can assign to test by just using <code>test.</code> + variable name and nothing else (no <code>static TestCipher{}</code>). Or you could use what the example does, it basically just skips the <code>EncryptText test;</code> part and puts it on one line, like <code>static TestVector const testVectorSpeck128 = {</code> and assigns inside the curly brackets just using <code>.</code> + variable name (without <code>test</code> or <code>testVectorSpeck128</code>). </p>

<p>Now, the second error</p>

<pre><code> 'key' was not declared in this scope
      cipher-&gt;setKey(key, keySize);
</code></pre>

<p>is that the variable <code>key</code> is not defined in the function <code>testCipher</code> just like the error says, you have to define that variable or use the right one, in the example it was done using a function parameter (you commented out) <code>TestVector *test</code>, it was dereferenced and accessed with <code>test-&gt;key</code>. I assume you've properly defined that struct now, there's no need to deal with pointers and with direct reference to the data you can use it elsewhere by just using something like this</p>

<pre><code>cipher-&gt;setKey(test.key, keySize);
</code></pre>

<p>rest of the errors are of similar fashion and can be fixed by just adding <code>test.</code> like I showed. If you fix those errors rest should be simple already.</p>

<p>As you are just learning, take small steps modifying the examples and use the <code>Verify</code> button as often as possible, Arduino IDE also has a button to autoformat code, use it, makes your code more readable for you and everyone else.</p>
 13425: <p>It looks like you want to create a struct and initialize it. Like this:</p>

<pre><code>struct EncryptText
{
    const char *name;
    byte key[32];
    byte plaintext[16];
    byte ciphertext[16];
};

EncryptText test = {
    "Speck-128-ECB",
    {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
                     0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00},
    {0x6c, 0x61, 0x76, 0x69, 0x75, 0x71, 0x65, 0x20,
                     0x74, 0x69, 0x20, 0x65, 0x64, 0x61, 0x6d, 0x20},
    {0xa6, 0x5d, 0x98, 0x51, 0x79, 0x78, 0x32, 0x65,
                     0x78, 0x60, 0xfe, 0xdf, 0x5c, 0x57, 0x0d, 0x18}
};
</code></pre>

<p>Then it appears you want to use that object. Note that to access each member of the struct you have to use dot notation (ex: <code>test.key</code>):</p>

<pre><code>void testCipher(BlockCipher *cipher, size_t keySize, bool decryption = true)
{
    Serial.print(" Encryption ... ");
    cipher-&gt;setKey(test.key, keySize);
    cipher-&gt;encryptBlock(buffer, test.plaintext);

    for(byte b=0; b&lt;16; b++)
    {
        Serial.print(buffer[b], HEX);
    }

    if (memcmp(buffer, test.ciphertext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");

    if (!decryption)
        return;

    Serial.print(" Decryption ... ");
    cipher-&gt;decryptBlock(buffer, test.ciphertext);

    for(byte b=0; b&lt;16; b++)
    {
        Serial.print(buffer[b], HEX);
    }
    if (memcmp(buffer, test.plaintext, 16) == 0)
        Serial.println("Passed");
    else
        Serial.println("Failed");
}
</code></pre>
