8 #include <botan/emsa3.h>     9 #include <botan/hash_id.h>    18 SecureVector<byte> emsa3_encoding(
const MemoryRegion<byte>& msg,
    21                                   size_t hash_id_length)
    23    size_t output_length = output_bits / 8;
    24    if(output_length < hash_id_length + msg.size() + 10)
    25       throw Encoding_Error(
"emsa3_encoding: Output length is too small");
    27    SecureVector<byte> T(output_length);
    28    const size_t P_LENGTH = output_length - msg.size() - hash_id_length - 2;
    33    T.copy(P_LENGTH+2, hash_id, hash_id_length);
    34    T.copy(output_length-msg.size(), &msg[0], msg.size());
    45    hash->
update(input, length);
    66    return emsa3_encoding(msg, output_bits,
    67                          &hash_id[0], hash_id.
size());
    82       return (coded == emsa3_encoding(raw, key_bits,
    83                                       &hash_id[0], hash_id.
size()));
   112    message += std::make_pair(input, length);
   132    return emsa3_encoding(msg, output_bits, 0, 0);
   144       return (coded == emsa3_encoding(raw, key_bits, 0, 0));
 
void update(const byte[], size_t)
MemoryVector< byte > pkcs_hash_id(const std::string &name)
bool verify(const MemoryRegion< byte > &, const MemoryRegion< byte > &, size_t)
bool verify(const MemoryRegion< byte > &, const MemoryRegion< byte > &, size_t)
SecureVector< byte > encoding_of(const MemoryRegion< byte > &, size_t, RandomNumberGenerator &rng)
void update(const byte in[], size_t length)
SecureVector< byte > raw_data()
virtual std::string name() const =0
void set_mem(T *ptr, size_t n, byte val)
SecureVector< byte > raw_data()
void swap(Botan::MemoryRegion< T > &x, Botan::MemoryRegion< T > &y)
SecureVector< byte > encoding_of(const MemoryRegion< byte > &, size_t, RandomNumberGenerator &rng)
virtual size_t output_length() const =0
EMSA3(HashFunction *hash)
void update(const byte[], size_t)