diff options
Diffstat (limited to '')
| -rw-r--r-- | src/tests/blowfish.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/blowfish.cpp b/src/tests/blowfish.cpp index 293539d..89183e4 100644 --- a/src/tests/blowfish.cpp +++ b/src/tests/blowfish.cpp | |||
| @@ -48,6 +48,32 @@ static const char *testdat[34][3] ={ | |||
| 48 | 48 | ||
| 49 | int main( int argc, char *argv[] ) | 49 | int main( int argc, char *argv[] ) |
| 50 | { | 50 | { |
| 51 | MemBuf mb; | ||
| 52 | { | ||
| 53 | BlowfishEcb bf( mb ); | ||
| 54 | bf.setPassword( "01234567" ); | ||
| 55 | for( int j = 0; j < 4; j++ ) | ||
| 56 | { | ||
| 57 | bf.write("this is a test!!"+j, 1 ); | ||
| 58 | } | ||
| 59 | bf.write("this is a test!!"+4, 12 ); | ||
| 60 | } | ||
| 61 | mb.setPos( 0 ); | ||
| 62 | BlowfishEcb bf( mb ); | ||
| 63 | bf.setPassword( "01234567" ); | ||
| 64 | for( int j = 0; j < 3; j++ ) | ||
| 65 | { | ||
| 66 | char c; | ||
| 67 | bf.read( &c, 1 ); | ||
| 68 | sio << "char: '" << c << "'" << sio.nl; | ||
| 69 | } | ||
| 70 | |||
| 71 | char buf[100]; | ||
| 72 | int iR = bf.read( buf, 100 ); | ||
| 73 | buf[iR] = '\0'; | ||
| 74 | sio << "Got(" << iR << ") = '" << buf << "'" << sio.nl; | ||
| 75 | |||
| 76 | return 0; | ||
| 51 | 77 | ||
| 52 | for( int j = 0; j < 34; j++ ) | 78 | for( int j = 0; j < 34; j++ ) |
| 53 | { | 79 | { |
