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: AES_example shaun_larada Smartage
Fork of Crypto by
BlockCipher.h
00001 #ifndef BLOCK_CIPHER_H 00002 #define BLOCK_CIPHER_H 00003 00004 #include "Cipher.h" 00005 00006 enum BLOCK_CIPHER_MODE 00007 { 00008 ECB_MODE, 00009 CBC_MODE, 00010 PCBC_MODE 00011 }; 00012 00013 class BlockCipher : public Cipher 00014 { 00015 public : 00016 00017 BlockCipher(uint32_t bs, BLOCK_CIPHER_MODE m, uint8_t *iv = 0); 00018 virtual ~BlockCipher(); 00019 00020 virtual CIPHER_TYPE getType() const; 00021 uint32_t getBlockSize() const; 00022 void setIV(uint8_t *iv); 00023 00024 virtual void encrypt(uint8_t *out, uint8_t *in, uint32_t length); 00025 virtual void decrypt(uint8_t *out, uint8_t *in, uint32_t length); 00026 00027 protected : 00028 00029 virtual void encryptBlock(uint8_t *out, uint8_t *in) = 0; 00030 virtual void decryptBlock(uint8_t *out, uint8_t *in) = 0; 00031 00032 private : 00033 00034 uint32_t blockSize; 00035 BLOCK_CIPHER_MODE mode; 00036 uint8_t *IV; 00037 uint8_t *tmpIV; 00038 uint8_t *tmpdatain; 00039 uint8_t *tmpdata; 00040 }; 00041 00042 #endif
Generated on Mon Jul 18 2022 02:59:39 by
1.7.2
