#include <hex.h>

Public Types | |
| enum | Case { Uppercase, Lowercase } |
Public Member Functions | |
| virtual bool | attachable () |
| void | end_msg () |
| Hex_Encoder (bool newlines=false, u32bit line_length=72, Case the_case=Uppercase) | |
| Hex_Encoder (Case the_case) | |
| std::string | name () const |
| virtual void | start_msg () |
| void | write (const byte in[], u32bit length) |
Static Public Member Functions | |
| static void | encode (byte in, byte out[2], Case the_case=Uppercase) |
Protected Member Functions | |
| void | send (const MemoryRegion< byte > &in) |
| void | send (byte in) |
| void | send (const byte in[], u32bit length) |
Definition at line 18 of file hex.h.
| Botan::Hex_Encoder::Hex_Encoder | ( | Case | the_case | ) |
Create a hex encoder.
| the_case | the case to use in the encoded strings. |
Definition at line 35 of file hex.cpp.
References Botan::HEX_CODEC_BUFFER_SIZE, Botan::MemoryRegion< T >::resize(), and Botan::MemoryRegion< T >::size().
00035 : casing(c), line_length(0) 00036 { 00037 in.resize(HEX_CODEC_BUFFER_SIZE); 00038 out.resize(2*in.size()); 00039 counter = position = 0; 00040 }
| Botan::Hex_Encoder::Hex_Encoder | ( | bool | newlines = false, |
|
| u32bit | line_length = 72, |
|||
| Case | the_case = Uppercase | |||
| ) |
Create a hex encoder.
| newlines | should newlines be used | |
| line_length | if newlines are used, how long are lines | |
| the_case | the case to use in the encoded strings |
Definition at line 24 of file hex.cpp.
References Botan::HEX_CODEC_BUFFER_SIZE, Botan::MemoryRegion< T >::resize(), and Botan::MemoryRegion< T >::size().
00024 : 00025 casing(c), line_length(breaks ? length : 0) 00026 { 00027 in.resize(HEX_CODEC_BUFFER_SIZE); 00028 out.resize(2*in.size()); 00029 counter = position = 0; 00030 }
| virtual bool Botan::Filter::attachable | ( | ) | [inline, virtual, inherited] |
Check whether this filter is an attachable filter.
Reimplemented in Botan::DataSink, and Botan::SecureQueue.
Definition at line 50 of file filter.h.
| void Botan::Hex_Encoder::encode | ( | byte | in, | |
| byte | out[2], | |||
| Hex_Encoder::Case | casing = Uppercase | |||
| ) | [static] |
Encode a single byte into two hex characters
Definition at line 45 of file hex.cpp.
References Uppercase.
Referenced by Botan::BigInt::encode().
00046 { 00047 const byte* BIN_TO_HEX = ((casing == Uppercase) ? BIN_TO_HEX_UPPER : 00048 BIN_TO_HEX_LOWER); 00049 00050 out[0] = BIN_TO_HEX[((in >> 4) & 0x0F)]; 00051 out[1] = BIN_TO_HEX[((in ) & 0x0F)]; 00052 }
| void Botan::Hex_Encoder::end_msg | ( | ) | [virtual] |
Notify that the current message is finished; flush buffers and do end-of-message processing (if any).
Reimplemented from Botan::Filter.
Definition at line 109 of file hex.cpp.
References Botan::Filter::send().
00110 { 00111 encode_and_send(in, position); 00112 if(counter && line_length) 00113 send('\n'); 00114 counter = position = 0; 00115 }
| std::string Botan::Hex_Encoder::name | ( | ) | const [inline, virtual] |
Implements Botan::Filter.
Definition at line 31 of file hex.h.
| void Botan::Filter::send | ( | const MemoryRegion< byte > & | in | ) | [inline, protected, inherited] |
| in | some input for the filter |
Definition at line 68 of file filter.h.
References Botan::MemoryRegion< T >::begin(), Botan::Filter::send(), and Botan::MemoryRegion< T >::size().
Referenced by Botan::Filter::send().
00068 { send(in.begin(), in.size()); }
| void Botan::Filter::send | ( | byte | in | ) | [inline, protected, inherited] |
| in | some input for the filter |
Definition at line 63 of file filter.h.
References Botan::Filter::send().
Referenced by Botan::Filter::send().
00063 { send(&in, 1); }
| in | some input for the filter | |
| length | the length of in |
Definition at line 28 of file filter.cpp.
References Botan::MemoryRegion< T >::append(), Botan::MemoryRegion< T >::destroy(), Botan::MemoryRegion< T >::size(), and Botan::Filter::write().
Referenced by Botan::Zlib_Decompression::end_msg(), Botan::Zlib_Compression::end_msg(), Botan::PK_Verifier_Filter::end_msg(), Botan::PK_Signer_Filter::end_msg(), Botan::PK_Decryptor_Filter::end_msg(), Botan::PK_Encryptor_Filter::end_msg(), end_msg(), Botan::Bzip_Decompression::end_msg(), Botan::Bzip_Compression::end_msg(), Botan::Base64_Decoder::end_msg(), Botan::Base64_Encoder::end_msg(), Botan::MAC_Filter::end_msg(), Botan::Hash_Filter::end_msg(), Botan::Zlib_Compression::flush(), Botan::Bzip_Compression::flush(), Botan::Zlib_Decompression::write(), Botan::Zlib_Compression::write(), Botan::Bzip_Decompression::write(), Botan::Bzip_Compression::write(), and Botan::StreamCipher_Filter::write().
00029 { 00030 bool nothing_attached = true; 00031 for(u32bit j = 0; j != total_ports(); ++j) 00032 if(next[j]) 00033 { 00034 if(write_queue.size()) 00035 next[j]->write(write_queue, write_queue.size()); 00036 next[j]->write(input, length); 00037 nothing_attached = false; 00038 } 00039 00040 if(nothing_attached) 00041 write_queue.append(input, length); 00042 else 00043 write_queue.destroy(); 00044 }
| virtual void Botan::Filter::start_msg | ( | ) | [inline, virtual, inherited] |
Start a new message. Must be closed by end_msg() before another message can be started.
Reimplemented in Botan::Bzip_Compression, Botan::Bzip_Decompression, Botan::EAX_Base, Botan::Zlib_Compression, Botan::Zlib_Decompression, Botan::PBE_PKCS5v15, and Botan::PBE_PKCS5v20.
Definition at line 38 of file filter.h.
Write a portion of a message to this filter.
| input | the input as a byte array | |
| length | the length of the byte array input |
Implements Botan::Filter.
Definition at line 86 of file hex.cpp.
References Botan::MemoryRegion< T >::copy(), and Botan::MemoryRegion< T >::size().
00087 { 00088 in.copy(position, input, length); 00089 if(position + length >= in.size()) 00090 { 00091 encode_and_send(in, in.size()); 00092 input += (in.size() - position); 00093 length -= (in.size() - position); 00094 while(length >= in.size()) 00095 { 00096 encode_and_send(input, in.size()); 00097 input += in.size(); 00098 length -= in.size(); 00099 } 00100 in.copy(input, length); 00101 position = 0; 00102 } 00103 position += length; 00104 }
1.5.8