Botan  1.10.9
lookup_stream.cpp
Go to the documentation of this file.
1 /*
2 * Stream Cipher Lookup
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #include <botan/internal/core_engine.h>
9 #include <botan/scan_name.h>
10 
11 #if defined(BOTAN_HAS_ARC4)
12  #include <botan/arc4.h>
13 #endif
14 
15 #if defined(BOTAN_HAS_SALSA20)
16  #include <botan/salsa20.h>
17 #endif
18 
19 #if defined(BOTAN_HAS_TURING)
20  #include <botan/turing.h>
21 #endif
22 
23 #if defined(BOTAN_HAS_WID_WAKE)
24  #include <botan/wid_wake.h>
25 #endif
26 
27 namespace Botan {
28 
29 /*
30 * Look for an algorithm with this name
31 */
32 StreamCipher*
34  Algorithm_Factory&) const
35  {
36 #if defined(BOTAN_HAS_ARC4)
37  if(request.algo_name() == "ARC4")
38  return new ARC4(request.arg_as_integer(0, 0));
39  if(request.algo_name() == "RC4_drop")
40  return new ARC4(768);
41 #endif
42 
43 #if defined(BOTAN_HAS_SALSA20)
44  if(request.algo_name() == "Salsa20")
45  return new Salsa20;
46 #endif
47 
48 #if defined(BOTAN_HAS_TURING)
49  if(request.algo_name() == "Turing")
50  return new Turing;
51 #endif
52 
53 #if defined(BOTAN_HAS_WID_WAKE)
54  if(request.algo_name() == "WiderWake4+1-BE")
55  return new WiderWake_41_BE;
56 #endif
57 
58  return 0;
59  }
60 
61 }
StreamCipher * find_stream_cipher(const SCAN_Name &, Algorithm_Factory &) const
std::string algo_name() const
Definition: scan_name.h:37
size_t arg_as_integer(size_t i, size_t def_value) const
Definition: scan_name.cpp:167