Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

shake_cipher.h
Go to the documentation of this file.
1 /*
2 * SHAKE-128 as a stream cipher
3 * (C) 2016 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_SHAKE128_CIPHER_H_
9 #define BOTAN_SHAKE128_CIPHER_H_
10
11 #include <botan/stream_cipher.h>
12 #include <botan/secmem.h>
13
14 BOTAN_FUTURE_INTERNAL_HEADER(shake_cipher.h)
15
16 namespace Botan {
17
18 /**
19 * SHAKE-128 XOF presented as a stream cipher
20 */
21 class BOTAN_PUBLIC_API(2,0) SHAKE_128_Cipher final : public StreamCipher
22 {
23 public:
24 SHAKE_128_Cipher();
25
26 /**
27 * Produce more XOF output
28 */
29 void cipher(const uint8_t in[], uint8_t out[], size_t length) override;
30
31 /**
32 * Seeking is not supported, this function will throw
33 */
34 void seek(uint64_t offset) override;
35
36 /**
37 * IV not supported, this function will throw unless iv_len == 0
38 */
39 void set_iv(const uint8_t iv[], size_t iv_len) override;
40
41 Key_Length_Specification key_spec() const override;
42
43 void clear() override;
44 std::string name() const override;
45 StreamCipher* clone() const override;
46
47 private:
48 void key_schedule(const uint8_t key[], size_t key_len) override;
49
50 secure_vector<uint64_t> m_state; // internal state
51 secure_vector<uint8_t> m_buffer; // ciphertext buffer
52 size_t m_buf_pos; // position in m_buffer
53 };
54
55 }
56
57 #endif
Botan::Key_Length_Specification
Definition: key_spec.h:18
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:28
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan::StreamCipher::cipher
virtual void cipher(const uint8_t in[], uint8_t out[], size_t len)=0
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Botan::SymmetricAlgorithm::name
virtual std::string name() const =0
Botan::StreamCipher
Definition: stream_cipher.h:21
Botan::SymmetricAlgorithm::clear
virtual void clear()=0
Botan::StreamCipher::seek
virtual void seek(uint64_t offset)=0
Botan
Definition: alg_id.cpp:13
Botan::SHAKE_128_Cipher
Definition: shake_cipher.h:21
Botan::SymmetricAlgorithm::key_spec
virtual Key_Length_Specification key_spec() const =0
Botan::StreamCipher::clone
virtual StreamCipher * clone() const =0
Botan::StreamCipher::set_iv
virtual void set_iv(const uint8_t iv[], size_t iv_len)=0
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:139