From 1e9d8f7a92e43f61e4d9f478f6e8dd5ae206616e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 9 Apr 2012 16:35:15 +0000 Subject: Halfway through crypto-template conversion. --- src/experimental/cipher.h | 67 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 6 deletions(-) (limited to 'src/experimental/cipher.h') diff --git a/src/experimental/cipher.h b/src/experimental/cipher.h index 2327aa6..613bc88 100644 --- a/src/experimental/cipher.h +++ b/src/experimental/cipher.h @@ -5,17 +5,72 @@ namespace Bu { + template class Cipher : Bu::Filter { public: - Cipher( Bu::Stream &rNext ); - virtual ~Cipher(); + Cipher( Bu::Stream &rNext ) : + Bu::Filter( rNext ) + { + } - virtual void start(); - virtual Bu::size stop(); + virtual ~Cipher() + { + } - virtual Bu::size read( void *pBuf, Bu::size iBytes ); - virtual Bu::size write( const void *pBuf, Bu::size iBytes ); + virtual void start() + { + } + + virtual Bu::size stop() + { + return 0; + } + + virtual Bu::size read( void *pBuf, Bu::size iBytes ) + { + uint32_t i; + + if (iBytes%iBlockSize) + { + return 0; + } + + iBytes /= iBlockSize; + + for (i=0;i