TAY

Fork of Crypto_light by Edward Stott

Revision:
8:a090264e9b2d
Parent:
7:2dbbdfb08123
--- a/cipher/DES.cpp	Sat Sep 14 18:21:32 2013 +0000
+++ b/cipher/DES.cpp	Sat Sep 14 20:54:59 2013 +0000
@@ -1,6 +1,4 @@
 #include "DES.h"
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
 
@@ -215,21 +213,17 @@
 
 
 DES::DES(uint8_t *key):
-Cipher()
+BlockCipher(8,ECB_MODE)
 {
     generateSubKeys(key);
 }
 
-uint32_t DES::getBlockSize() const
+DES::DES(uint8_t *key, uint8_t *iv):
+BlockCipher(8,CBC_MODE, iv)
 {
-    return 8;
+    generateSubKeys(key);
 }
 
-CIPHER_TYPE DES::getType() const
-{
-    return BLOCK_CIPHER;
-};
-
 void DES::generateSubKeys(uint8_t *key)
 {
 
@@ -248,7 +242,7 @@
     }   
 }
 
-void DES::encrypt(uint8_t *out, uint8_t *in, uint32_t length)
+void DES::encryptBlock(uint8_t *out, uint8_t *in)
 {
     uint8_t tmp[8];
     memcpy(tmp, in, 8);
@@ -289,7 +283,7 @@
 }
 
 
-void DES::decrypt(uint8_t *out, uint8_t *in, uint32_t length)
+void DES::decryptBlock(uint8_t *out, uint8_t *in)
 {
     uint8_t tmp[8];
     memcpy(tmp, in, 8);