aboutsummaryrefslogtreecommitdiff
path: root/src/experimental/cipher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/experimental/cipher.cpp')
-rw-r--r--src/experimental/cipher.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/experimental/cipher.cpp b/src/experimental/cipher.cpp
index 3430c08..d6d01c7 100644
--- a/src/experimental/cipher.cpp
+++ b/src/experimental/cipher.cpp
@@ -1,65 +1,3 @@
1#include "bu/cipher.h" 1#include "bu/cipher.h"
2 2
3Bu::Cipher::Cipher( Bu::Stream &rNext ) :
4 Bu::Filter( rNext )
5{
6}
7
8Bu::Cipher::~Cipher()
9{
10}
11
12void Bu::Cipher::start()
13{
14}
15
16Bu::size Bu::Cipher::stop()
17{
18 return 0;
19}
20
21Bu::size Bu::Cipher::read( void *pBuf, Bu::size iBytes )
22{
23 uint32_t i;
24
25 if (iBytes%8)
26 {
27 return 0;
28 }
29
30 iBytes /= 8;
31
32 for (i=0;i<iBytes;i++)
33 {
34 void *pSeg = ((char *)pBuf)+(i*8);
35 int iRead = rNext.read( pSeg, 8 );
36 decipher( pSeg );
37 }
38
39 return iBytes*8;
40}
41
42Bu::size Bu::Cipher::write( const void *pBuf, Bu::size iBytes )
43{
44 uint32_t i;
45
46 if (iBytes%8)
47 {
48 return 0;
49 }
50
51 iBytes /= 8;
52
53 char buf[8];
54
55 for (i=0;i<iBytes;i++)
56 {
57 memcpy( buf, ((const char *)pBuf)+(i*8), 8 );
58 encipher( buf );
59 rNext.write( buf, 8 );
60 }
61
62 memset( &buf, 0, 8 );
63 return iBytes*8;
64}
65 3