Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ES_CW2_Starter_JIN EMBEDDED_CW2 EMBEDDED_CW2_Final Spinnybois ... more
Fork of Crypto by
cipher/BlockCipher.h
- Committer:
- estott
- Date:
- 2018-03-09
- Revision:
- 15:634f9c4cbab1
- Parent:
- 8:a090264e9b2d
File content as of revision 15:634f9c4cbab1:
#ifndef BLOCK_CIPHER_H
#define BLOCK_CIPHER_H
#include "Cipher.h"
enum BLOCK_CIPHER_MODE
{
ECB_MODE,
CBC_MODE
};
class BlockCipher : public Cipher
{
public :
BlockCipher(uint32_t bs, BLOCK_CIPHER_MODE m, uint8_t *iv = 0);
virtual ~BlockCipher();
virtual CIPHER_TYPE getType() const;
uint32_t getBlockSize() const;
virtual void encrypt(uint8_t *out, uint8_t *in, uint32_t length);
virtual void decrypt(uint8_t *out, uint8_t *in, uint32_t length);
protected :
virtual void encryptBlock(uint8_t *out, uint8_t *in) = 0;
virtual void decryptBlock(uint8_t *out, uint8_t *in) = 0;
private :
uint32_t blockSize;
BLOCK_CIPHER_MODE mode;
uint8_t *IV;
};
#endif
