Botan 1.10.17

eme.cpp
Go to the documentation of this file.
1 /*
2 * EME Base Class
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #include <botan/eme.h>
9
10 namespace Botan {
11
12 /*
13 * Encode a message
14 */
15 SecureVector<byte> EME::encode(const byte msg[], size_t msg_len,
16 size_t key_bits,
17 RandomNumberGenerator& rng) const
18 {
19 return pad(msg, msg_len, key_bits, rng);
20 }
21
22 /*
23 * Encode a message
24 */
25 SecureVector<byte> EME::encode(const MemoryRegion<byte>& msg,
26 size_t key_bits,
27 RandomNumberGenerator& rng) const
28 {
29 return pad(&msg[0], msg.size(), key_bits, rng);
30 }
31
32 /*
33 * Decode a message
34 */
35 SecureVector<byte> EME::decode(const byte msg[], size_t msg_len,
36 size_t key_bits) const
37 {
38 return unpad(msg, msg_len, key_bits);
39 }
40
41 /*
42 * Decode a message
43 */
44 SecureVector<byte> EME::decode(const MemoryRegion<byte>& msg,
45 size_t key_bits) const
46 {
47 return unpad(&msg[0], msg.size(), key_bits);
48 }
49
50 }
Botan::RandomNumberGenerator
Definition: rng.h:20
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::EME::decode
SecureVector< byte > decode(const byte in[], size_t in_length, size_t key_length) const
Definition: eme.cpp:35
Botan::MemoryRegion< byte >
Botan
Definition: algo_base.h:14
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29
Botan::SecureVector< byte >
Botan::EME::encode
SecureVector< byte > encode(const byte in[], size_t in_length, size_t key_length, RandomNumberGenerator &rng) const
Definition: eme.cpp:15