This library implements some hash and cryptographic algorithms.
Dependents: ES_CW2_Starter_JIN EMBEDDED_CW2 EMBEDDED_CW2_Final Spinnybois ... more
Fork of Crypto by
Diff: cipher/BlockCipher.h
- Revision:
- 8:a090264e9b2d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cipher/BlockCipher.h Sat Sep 14 20:54:59 2013 +0000 @@ -0,0 +1,37 @@ +#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