Botan  2.9.0
Crypto and TLS for C++11
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 namespace Botan {
15 
16 /**
17 * SHAKE-128 XOF presented as a stream cipher
18 */
20  {
21  public:
23 
24  /**
25  * Produce more XOF output
26  */
27  void cipher(const uint8_t in[], uint8_t out[], size_t length) override;
28 
29  /**
30  * Seeking is not supported, this function will throw
31  */
32  void seek(uint64_t offset) override;
33 
34  /**
35  * IV not supported, this function will throw unless iv_len == 0
36  */
37  void set_iv(const uint8_t iv[], size_t iv_len) override;
38 
39  Key_Length_Specification key_spec() const override;
40 
41  void clear() override;
42  std::string name() const override;
43  StreamCipher* clone() const override;
44 
45  private:
46  void key_schedule(const uint8_t key[], size_t key_len) override;
47 
48  secure_vector<uint64_t> m_state; // internal state
49  secure_vector<uint8_t> m_buffer; // ciphertext buffer
50  size_t m_buf_pos; // position in m_buffer
51  };
52 
53 }
54 
55 #endif
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
std::string name
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65