Botan 1.10.17
Botan::MGF1 Class Reference

#include <mgf1.h>

Inheritance diagram for Botan::MGF1:
Botan::MGF

Public Member Functions

void mask (const byte[], size_t, byte[], size_t) const
 MGF1 (HashFunction *hash)
 ~MGF1 ()

Detailed Description

MGF1 from PKCS #1 v2.0

Definition at line 19 of file mgf1.h.

Constructor & Destructor Documentation

◆ MGF1()

Botan::MGF1::MGF1 ( HashFunction * hash)

MGF1 constructor: takes ownership of hash

Definition at line 42 of file mgf1.cpp.

42 : hash(h)
43 {
44 if(!hash)
45 throw Invalid_Argument("MGF1 given null hash object");
46 }
std::invalid_argument Invalid_Argument
Definition exceptn.h:20

Referenced by Botan::EME1::EME1(), Botan::EMSA4::EMSA4(), and Botan::EMSA4::EMSA4().

◆ ~MGF1()

Botan::MGF1::~MGF1 ( )

Definition at line 51 of file mgf1.cpp.

52 {
53 delete hash;
54 }

Member Function Documentation

◆ mask()

void Botan::MGF1::mask ( const byte in[],
size_t in_len,
byte out[],
size_t out_len ) const
virtual

Implements Botan::MGF.

Definition at line 19 of file mgf1.cpp.

21 {
22 u32bit counter = 0;
23
24 while(out_len)
25 {
26 hash->update(in, in_len);
27 hash->update_be(counter);
28 SecureVector<byte> buffer = hash->final();
29
30 size_t xored = std::min<size_t>(buffer.size(), out_len);
31 xor_buf(out, &buffer[0], xored);
32 out += xored;
33 out_len -= xored;
34
35 ++counter;
36 }
37 }
void xor_buf(byte out[], const byte in[], size_t length)
Definition xor_buf.h:21
unsigned int u32bit
Definition types.h:32

References Botan::MemoryRegion< T >::size(), and Botan::xor_buf().


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