aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-10-23 01:11:46 +0000
committerlloyd <[email protected]>2009-10-23 01:11:46 +0000
commit377a213c32f33d42e66bad1eb7f7c66b63c1249a (patch)
tree4ba28c0c1f16dfbf7c495606f62c9558ac7326ff /src
parent197a9e477369c8520d0e46747cb5fc1d71666d33 (diff)
Increase the internal buffer size of the Hex coder/decoder, and put it into
a named constant instead of being magic. Move from 64 bytes to 256. This was necessary to allow Pipe(new Hex_Decoder, filter, ...) to give filter a sufficiently large input block. It would be nicer if the filter itself (in this case, ECB_Decryption, but others apply as well) was smart enough to buffer on its own. It might also be useful if code could query what parallelism a block cipher provided and modify their actions accordingly.
Diffstat (limited to 'src')
-rw-r--r--src/codec/hex/hex.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/codec/hex/hex.cpp b/src/codec/hex/hex.cpp
index fbacc278b..201c9bfdf 100644
--- a/src/codec/hex/hex.cpp
+++ b/src/codec/hex/hex.cpp
@@ -13,13 +13,15 @@
namespace Botan {
+const u32bit HEX_CODEC_BUFFER_SIZE = 256;
+
/*
* Hex_Encoder Constructor
*/
Hex_Encoder::Hex_Encoder(bool breaks, u32bit length, Case c) :
casing(c), line_length(breaks ? length : 0)
{
- in.create(64);
+ in.create(HEX_CODEC_BUFFER_SIZE);
out.create(2*in.size());
counter = position = 0;
}
@@ -29,7 +31,7 @@ Hex_Encoder::Hex_Encoder(bool breaks, u32bit length, Case c) :
*/
Hex_Encoder::Hex_Encoder(Case c) : casing(c), line_length(0)
{
- in.create(64);
+ in.create(HEX_CODEC_BUFFER_SIZE);
out.create(2*in.size());
counter = position = 0;
}
@@ -114,7 +116,7 @@ void Hex_Encoder::end_msg()
*/
Hex_Decoder::Hex_Decoder(Decoder_Checking c) : checking(c)
{
- in.create(64);
+ in.create(HEX_CODEC_BUFFER_SIZE);
out.create(in.size() / 2);
position = 0;
}