aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
Diffstat (limited to 'src/unit')
-rw-r--r--src/unit/archive.unit2
-rw-r--r--src/unit/array.unit2
-rw-r--r--src/unit/base64.unit2
-rw-r--r--src/unit/blowfish.unit78
-rw-r--r--src/unit/buffer.unit2
-rw-r--r--src/unit/entities/unit2
-rw-r--r--src/unit/file.unit2
-rw-r--r--src/unit/hash.unit2
-rw-r--r--src/unit/list.unit2
-rw-r--r--src/unit/membuf.unit2
-rw-r--r--src/unit/myriad.unit2
-rw-r--r--src/unit/queuebuf.unit2
-rw-r--r--src/unit/string.unit2
-rw-r--r--src/unit/substream.unit2
-rw-r--r--src/unit/taf.unit2
-rw-r--r--src/unit/variant.unit2
-rw-r--r--src/unit/xml.unit2
17 files changed, 94 insertions, 16 deletions
diff --git a/src/unit/archive.unit b/src/unit/archive.unit
index 89fde0c..359f380 100644
--- a/src/unit/archive.unit
+++ b/src/unit/archive.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/array.unit b/src/unit/array.unit
index f6e6718..6e985d8 100644
--- a/src/unit/array.unit
+++ b/src/unit/array.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/base64.unit b/src/unit/base64.unit
index e4630c5..5266b48 100644
--- a/src/unit/base64.unit
+++ b/src/unit/base64.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/blowfish.unit b/src/unit/blowfish.unit
new file mode 100644
index 0000000..abab63d
--- /dev/null
+++ b/src/unit/blowfish.unit
@@ -0,0 +1,78 @@
1// vim: syntax=cpp
2/*
3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 *
5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE.
7 */
8
9#include "bu/blowfish.h"
10#include "bu/hex.h"
11#include "bu/strfilter.h"
12
13#include "bu/sio.h"
14
15static const char *testdat[34][3] ={
16{"0000000000000000", "0000000000000000", "4EF997456198DD78"},
17{"FFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFF", "51866FD5B85ECB8A"},
18{"3000000000000000", "1000000000000001", "7D856F9A613063F2"},
19{"1111111111111111", "1111111111111111", "2466DD878B963C9D"},
20{"0123456789ABCDEF", "1111111111111111", "61F9C3802281B096"},
21{"1111111111111111", "0123456789ABCDEF", "7D0CC630AFDA1EC7"},
22{"0000000000000000", "0000000000000000", "4EF997456198DD78"},
23{"FEDCBA9876543210", "0123456789ABCDEF", "0ACEAB0FC6A0A28D"},
24{"7CA110454A1A6E57", "01A1D6D039776742", "59C68245EB05282B"},
25{"0131D9619DC1376E", "5CD54CA83DEF57DA", "B1B8CC0B250F09A0"},
26{"07A1133E4A0B2686", "0248D43806F67172", "1730E5778BEA1DA4"},
27{"3849674C2602319E", "51454B582DDF440A", "A25E7856CF2651EB"},
28{"04B915BA43FEB5B6", "42FD443059577FA2", "353882B109CE8F1A"},
29{"0113B970FD34F2CE", "059B5E0851CF143A", "48F4D0884C379918"},
30{"0170F175468FB5E6", "0756D8E0774761D2", "432193B78951FC98"},
31{"43297FAD38E373FE", "762514B829BF486A", "13F04154D69D1AE5"},
32{"07A7137045DA2A16", "3BDD119049372802", "2EEDDA93FFD39C79"},
33{"04689104C2FD3B2F", "26955F6835AF609A", "D887E0393C2DA6E3"},
34{"37D06BB516CB7546", "164D5E404F275232", "5F99D04F5B163969"},
35{"1F08260D1AC2465E", "6B056E18759F5CCA", "4A057A3B24D3977B"},
36{"584023641ABA6176", "004BD6EF09176062", "452031C1E4FADA8E"},
37{"025816164629B007", "480D39006EE762F2", "7555AE39F59B87BD"},
38{"49793EBC79B3258F", "437540C8698F3CFA", "53C55F9CB49FC019"},
39{"4FB05E1515AB73A7", "072D43A077075292", "7A8E7BFA937E89A3"},
40{"49E95D6D4CA229BF", "02FE55778117F12A", "CF9C5D7A4986ADB5"},
41{"018310DC409B26D6", "1D9D5C5018F728C2", "D1ABB290658BC778"},
42{"1C587F1C13924FEF", "305532286D6F295A", "55CB3774D13EF201"},
43{"0101010101010101", "0123456789ABCDEF", "FA34EC4847B268B2"},
44{"1F1F1F1F0E0E0E0E", "0123456789ABCDEF", "A790795108EA3CAE"},
45{"E0FEE0FEF1FEF1FE", "0123456789ABCDEF", "C39E072D9FAC631D"},
46{"0000000000000000", "FFFFFFFFFFFFFFFF", "014933E0CDAFF6E4"},
47{"FFFFFFFFFFFFFFFF", "0000000000000000", "F21E9A77B71C49BC"},
48{"0123456789ABCDEF", "0000000000000000", "245946885754369A"},
49{"FEDCBA9876543210", "FFFFFFFFFFFFFFFF", "6B5C5A9C5D9E0A5A"}};
50
51suite Blowfish
52{
53 test standard
54 {
55 for( int j = 0; j < 34; j++ )
56 {
57 Bu::MemBuf mb;
58 Bu::BlowfishEcb bf( mb );
59 bf.setPassword( Bu::decodeStr<Bu::Hex>( testdat[j][0] ) );
60 bf.write( Bu::decodeStr<Bu::Hex>( testdat[j][1] ) );
61 unitTest(
62 mb.getString() == Bu::decodeStr<Bu::Hex>( testdat[j][2] )
63 );
64
65 mb.setPos( 0 );
66 Bu::BlowfishEcb bf2( mb );
67 bf2.setPassword( Bu::decodeStr<Bu::Hex>( testdat[j][0] ) );
68 char buf[8];
69 bf2.read( buf, 8 );
70
71 unitTest(
72 Bu::String(testdat[j][1]) ==
73 Bu::encodeStr<Bu::Hex>(Bu::String(buf,8),true)
74 );
75 }
76 }
77}
78
diff --git a/src/unit/buffer.unit b/src/unit/buffer.unit
index 8106e4e..8bfdc3d 100644
--- a/src/unit/buffer.unit
+++ b/src/unit/buffer.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/entities/unit b/src/unit/entities/unit
index 4c5a835..2b5e637 100644
--- a/src/unit/entities/unit
+++ b/src/unit/entities/unit
@@ -5,7 +5,7 @@
5 name="source" 5 name="source"
6 filename="{=name:%tolower}.cpp" 6 filename="{=name:%tolower}.cpp"
7>/* 7>/*
8 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 8 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
9 * 9 *
10 * This file is part of the libbu++ library and is released under the 10 * This file is part of the libbu++ library and is released under the
11 * terms of the license contained in the file LICENSE. 11 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/file.unit b/src/unit/file.unit
index efca4f1..7140d03 100644
--- a/src/unit/file.unit
+++ b/src/unit/file.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/hash.unit b/src/unit/hash.unit
index 7148693..3abc6a5 100644
--- a/src/unit/hash.unit
+++ b/src/unit/hash.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/list.unit b/src/unit/list.unit
index 2b315dc..ec92fd5 100644
--- a/src/unit/list.unit
+++ b/src/unit/list.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/membuf.unit b/src/unit/membuf.unit
index aefc2c1..37ea77e 100644
--- a/src/unit/membuf.unit
+++ b/src/unit/membuf.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/myriad.unit b/src/unit/myriad.unit
index e0f7ef4..8c96f79 100644
--- a/src/unit/myriad.unit
+++ b/src/unit/myriad.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/queuebuf.unit b/src/unit/queuebuf.unit
index 605490e..553d9fc 100644
--- a/src/unit/queuebuf.unit
+++ b/src/unit/queuebuf.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/string.unit b/src/unit/string.unit
index 5298f8a..acef0d5 100644
--- a/src/unit/string.unit
+++ b/src/unit/string.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/substream.unit b/src/unit/substream.unit
index 456e69a..c66238d 100644
--- a/src/unit/substream.unit
+++ b/src/unit/substream.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/taf.unit b/src/unit/taf.unit
index 5fedcec..12e93c2 100644
--- a/src/unit/taf.unit
+++ b/src/unit/taf.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/variant.unit b/src/unit/variant.unit
index 53abdc0..684bea1 100644
--- a/src/unit/variant.unit
+++ b/src/unit/variant.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.
diff --git a/src/unit/xml.unit b/src/unit/xml.unit
index ab339c2..0db21c1 100644
--- a/src/unit/xml.unit
+++ b/src/unit/xml.unit
@@ -1,6 +1,6 @@
1// vim: syntax=cpp 1// vim: syntax=cpp
2/* 2/*
3 * Copyright (C) 2007-2011 Xagasoft, All rights reserved. 3 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
4 * 4 *
5 * This file is part of the libbu++ library and is released under the 5 * This file is part of the libbu++ library and is released under the
6 * terms of the license contained in the file LICENSE. 6 * terms of the license contained in the file LICENSE.