diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-04-09 16:35:15 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-04-09 16:35:15 +0000 |
commit | 1e9d8f7a92e43f61e4d9f478f6e8dd5ae206616e (patch) | |
tree | 65cb355aa0a99bf4b9ad94ef4525065880e3ecd1 /src/experimental/cipher.cpp | |
parent | 228b885b41652a015a91770dfd993456d76ad102 (diff) | |
download | libbu++-1e9d8f7a92e43f61e4d9f478f6e8dd5ae206616e.tar.gz libbu++-1e9d8f7a92e43f61e4d9f478f6e8dd5ae206616e.tar.bz2 libbu++-1e9d8f7a92e43f61e4d9f478f6e8dd5ae206616e.tar.xz libbu++-1e9d8f7a92e43f61e4d9f478f6e8dd5ae206616e.zip |
Halfway through crypto-template conversion.
Diffstat (limited to '')
-rw-r--r-- | src/experimental/cipher.cpp | 62 |
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 | ||
3 | Bu::Cipher::Cipher( Bu::Stream &rNext ) : | ||
4 | Bu::Filter( rNext ) | ||
5 | { | ||
6 | } | ||
7 | |||
8 | Bu::Cipher::~Cipher() | ||
9 | { | ||
10 | } | ||
11 | |||
12 | void Bu::Cipher::start() | ||
13 | { | ||
14 | } | ||
15 | |||
16 | Bu::size Bu::Cipher::stop() | ||
17 | { | ||
18 | return 0; | ||
19 | } | ||
20 | |||
21 | Bu::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 | |||
42 | Bu::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 | ||