Arduino Cryptography Library
Public Member Functions | Friends | List of all members
SpeckTiny Class Reference

Speck block cipher with a 128-bit block size (tiny-memory version). More...

#include <SpeckTiny.h>

Inheritance diagram for SpeckTiny:
BlockCipher SpeckSmall

Public Member Functions

 SpeckTiny ()
 Constructs a tiny-memory Speck block cipher with no initial key. More...
 
size_t blockSize () const
 Size of a single block processed by this cipher, in bytes. More...
 
size_t keySize () const
 Default size of the key for this block cipher, in bytes. More...
 
bool setKey (const uint8_t *key, size_t len)
 Sets the key to use for future encryption and decryption operations. More...
 
void encryptBlock (uint8_t *output, const uint8_t *input)
 Encrypts a single block using this cipher. More...
 
void decryptBlock (uint8_t *output, const uint8_t *input)
 Decrypts a single block using this cipher. More...
 
void clear ()
 Clears all security-sensitive state from this block cipher. More...
 
- Public Member Functions inherited from BlockCipher
 BlockCipher ()
 Constructs a block cipher.
 
virtual ~BlockCipher ()
 Destroys this block cipher object. More...
 

Friends

class SpeckSmall
 

Detailed Description

Speck block cipher with a 128-bit block size (tiny-memory version).

This class differs from the Speck class in the following ways:

This class is useful when RAM is at a premium, CBC mode is not required, and reduced encryption performance is not a hindrance to the application. Even though the performance of encryptBlock() is reduced, this class is still faster than AES with equivalent key sizes.

The companion SpeckSmall class supports decryptBlock() at the cost of some additional memory and slower setKey() times.

See the documentation for the Speck class for more information on the Speck family of block ciphers.

References: https://en.wikipedia.org/wiki/Speck_%28cipher%29, http://eprint.iacr.org/2013/404

See also
Speck, SpeckSmall

Definition at line 30 of file SpeckTiny.h.

Constructor & Destructor Documentation

◆ SpeckTiny()

SpeckTiny::SpeckTiny ( )

Constructs a tiny-memory Speck block cipher with no initial key.

This constructor must be followed by a call to setKey() before the block cipher can be used for encryption.

Definition at line 76 of file SpeckTiny.cpp.

Member Function Documentation

◆ blockSize()

size_t SpeckTiny::blockSize ( ) const
virtual

Size of a single block processed by this cipher, in bytes.

Returns
Returns the size of a block in bytes.
See also
keySize(), encryptBlock()

Implements BlockCipher.

Definition at line 86 of file SpeckTiny.cpp.

◆ clear()

void SpeckTiny::clear ( )
virtual

Clears all security-sensitive state from this block cipher.

Security-sensitive information includes key schedules and any temporary state that is used by encryptBlock() or decryptBlock() which is stored in the object itself.

See also
setKey(), encryptBlock(), decryptBlock()

Implements BlockCipher.

Definition at line 453 of file SpeckTiny.cpp.

◆ decryptBlock()

void SpeckTiny::decryptBlock ( uint8_t *  output,
const uint8_t *  input 
)
virtual

Decrypts a single block using this cipher.

Parameters
outputThe output buffer to put the plaintext into. Must be at least blockSize() bytes in length.
inputThe input buffer to read the ciphertext from which is allowed to overlap with output. Must be at least blockSize() bytes in length.
See also
encryptBlock(), blockSize()

Implements BlockCipher.

Definition at line 448 of file SpeckTiny.cpp.

◆ encryptBlock()

void SpeckTiny::encryptBlock ( uint8_t *  output,
const uint8_t *  input 
)
virtual

Encrypts a single block using this cipher.

Parameters
outputThe output buffer to put the ciphertext into. Must be at least blockSize() bytes in length.
inputThe input buffer to read the plaintext from which is allowed to overlap with output. Must be at least blockSize() bytes in length.
See also
decryptBlock(), blockSize()

Implements BlockCipher.

Definition at line 156 of file SpeckTiny.cpp.

◆ keySize()

size_t SpeckTiny::keySize ( ) const
virtual

Default size of the key for this block cipher, in bytes.

This value indicates the default, or recommended, size for the key.

See also
setKey(), blockSize()

Implements BlockCipher.

Definition at line 91 of file SpeckTiny.cpp.

◆ setKey()

bool SpeckTiny::setKey ( const uint8_t *  key,
size_t  len 
)
virtual

Sets the key to use for future encryption and decryption operations.

Parameters
keyThe key to use.
lenThe length of the key.
Returns
Returns false if the key length is not supported, or the key is somehow "weak" and unusable by this cipher.

Use clear() or the destructor to remove the key and any other sensitive data from the object once encryption or decryption is complete.

See also
keySize(), clear()

Implements BlockCipher.

Definition at line 109 of file SpeckTiny.cpp.


The documentation for this class was generated from the following files: