Botan  1.11.17
Public Types | Public Member Functions | List of all members
Botan::Zlib_Compression Class Reference

#include <zlib.h>

Inheritance diagram for Botan::Zlib_Compression:
Botan::Stream_Compression Botan::Compressor_Transform Botan::Transform

Public Types

typedef SCAN_Name Spec
 

Public Member Functions

void clear () override
 
size_t default_nonce_length () const overridefinal
 
void finish (secure_vector< byte > &buf, size_t offset=0) override
 
void flush (secure_vector< byte > &buf, size_t offset=0) override
 
size_t minimum_final_size () const overridefinal
 
std::string name () const override
 
size_t output_length (size_t) const overridefinal
 
virtual std::string provider () const
 
template<typename Alloc >
secure_vector< bytestart (const std::vector< byte, Alloc > &nonce)
 
secure_vector< bytestart (const byte nonce[], size_t nonce_len)
 
secure_vector< bytestart ()
 
template<typename Alloc >
secure_vector< bytestart_vec (const std::vector< byte, Alloc > &nonce)
 
void update (secure_vector< byte > &buf, size_t offset=0) override
 
size_t update_granularity () const overridefinal
 
bool valid_nonce_length (size_t nonce_len) const overridefinal
 
 Zlib_Compression (size_t level=6)
 

Detailed Description

Zlib Compression

Definition at line 19 of file zlib.h.

Member Typedef Documentation

typedef SCAN_Name Botan::Transform::Spec
inherited

Definition at line 27 of file transform.h.

Constructor & Destructor Documentation

Botan::Zlib_Compression::Zlib_Compression ( size_t  level = 6)
inline
Parameters
levelhow much effort to use on compressing (0 to 9); higher levels are slower but tend to give better compression

Definition at line 28 of file zlib.h.

28 : m_level(level) {}

Member Function Documentation

void Botan::Stream_Compression::clear ( )
overridevirtualinherited

Implements Botan::Transform.

Definition at line 85 of file compression.cpp.

Referenced by Botan::Stream_Compression::finish().

86  {
87  m_stream.reset();
88  }
size_t Botan::Compressor_Transform::default_nonce_length ( ) const
inlinefinaloverridevirtualinherited

Return the default size for a nonce

Implements Botan::Transform.

Definition at line 22 of file compression.h.

22 { return 0; }
void Botan::Stream_Compression::finish ( secure_vector< byte > &  final_block,
size_t  offset = 0 
)
overridevirtualinherited

Complete processing of a message.

Parameters
final_blockin/out parameter which must be at least minimum_final_size() bytes, and will be set to any final output
offsetan offset into final_block to begin processing

Implements Botan::Transform.

Definition at line 143 of file compression.cpp.

References BOTAN_ASSERT, and Botan::Stream_Compression::clear().

144  {
145  BOTAN_ASSERT(m_stream, "Initialized");
146  process(buf, offset, m_stream->finish_flag());
147  clear();
148  }
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
void Botan::Stream_Compression::flush ( secure_vector< byte > &  buf,
size_t  offset = 0 
)
overridevirtualinherited

Reimplemented from Botan::Compressor_Transform.

Definition at line 137 of file compression.cpp.

References BOTAN_ASSERT.

138  {
139  BOTAN_ASSERT(m_stream, "Initialized");
140  process(buf, offset, m_stream->flush_flag());
141  }
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
size_t Botan::Compressor_Transform::minimum_final_size ( ) const
inlinefinaloverridevirtualinherited
Returns
required minimium size to finalize() - may be any length larger than this.

Implements Botan::Transform.

Definition at line 20 of file compression.h.

20 { return 0; }
std::string Botan::Zlib_Compression::name ( ) const
inlineoverridevirtual

Implements Botan::Transform.

Definition at line 30 of file zlib.h.

30 { return "Zlib_Compression"; }
size_t Botan::Compressor_Transform::output_length ( size_t  input_length) const
inlinefinaloverridevirtualinherited

Returns the size of the output if this transform is used to process a message with input_length bytes. Will throw if unable to give a precise answer.

Implements Botan::Transform.

Definition at line 29 of file compression.h.

30  {
31  throw std::runtime_error(name() + " output length indeterminate");
32  }
virtual std::string name() const =0
virtual std::string Botan::Transform::provider ( ) const
inlinevirtualinherited

Return some short name describing the provider of this tranformation. Useful in cases where multiple implementations are available (eg, different implementations of AES). Default "core" is used for the 'standard' implementation included in the library.

Definition at line 120 of file transform.h.

120 { return "core"; }
template<typename Alloc >
secure_vector<byte> Botan::Transform::start ( const std::vector< byte, Alloc > &  nonce)
inlineinherited

Begin processing a message.

Parameters
noncethe per message nonce

Definition at line 34 of file transform.h.

Referenced by botan_cipher_start().

35  {
36  return start(&nonce[0], nonce.size());
37  }
secure_vector< byte > start()
Definition: transform.h:63
secure_vector<byte> Botan::Transform::start ( const byte  nonce[],
size_t  nonce_len 
)
inlineinherited

Begin processing a message.

Parameters
noncethe per message nonce
nonce_lenlength of nonce

Definition at line 55 of file transform.h.

56  {
57  return start_raw(nonce, nonce_len);
58  }
virtual secure_vector< byte > start_raw(const byte nonce[], size_t nonce_len)=0
secure_vector<byte> Botan::Transform::start ( )
inlineinherited

Begin processing a message.

Definition at line 63 of file transform.h.

64  {
65  return start_raw(nullptr, 0);
66  }
virtual secure_vector< byte > start_raw(const byte nonce[], size_t nonce_len)=0
template<typename Alloc >
secure_vector<byte> Botan::Transform::start_vec ( const std::vector< byte, Alloc > &  nonce)
inlineinherited

Begin processing a message.

Parameters
noncethe per message nonce

Definition at line 45 of file transform.h.

46  {
47  return start(&nonce[0], nonce.size());
48  }
secure_vector< byte > start()
Definition: transform.h:63
void Botan::Stream_Compression::update ( secure_vector< byte > &  blocks,
size_t  offset = 0 
)
overridevirtualinherited

Process some data. Input must be in size update_granularity() byte blocks.

Parameters
blocksin/out paramter which will possibly be resized
offsetan offset into blocks to begin processing

Implements Botan::Transform.

Definition at line 131 of file compression.cpp.

References BOTAN_ASSERT.

132  {
133  BOTAN_ASSERT(m_stream, "Initialized");
134  process(buf, offset, m_stream->run_flag());
135  }
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
size_t Botan::Compressor_Transform::update_granularity ( ) const
inlinefinaloverridevirtualinherited
Returns
size of required blocks to update

Implements Botan::Transform.

Definition at line 18 of file compression.h.

18 { return 1; }
bool Botan::Compressor_Transform::valid_nonce_length ( size_t  nonce_len) const
inlinefinaloverridevirtualinherited

Return true iff nonce_len is a valid length for the nonce

Implements Botan::Transform.

Definition at line 24 of file compression.h.

25  { return nonce_len == 0; }

The documentation for this class was generated from the following files: