• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 13215274653

08 Feb 2025 11:38AM UTC coverage: 91.655% (-0.009%) from 91.664%
13215274653

Pull #4650

github

web-flow
Merge 107f31833 into bc555cd3c
Pull Request #4650: Reorganize code and reduce header dependencies

94836 of 103471 relevant lines covered (91.65%)

11230958.94 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/lib/block/blowfish/blowfish.h
1
/*
2
* Blowfish
3
* (C) 1999-2011 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7

8
#ifndef BOTAN_BLOWFISH_H_
9
#define BOTAN_BLOWFISH_H_
10

11
#include <botan/block_cipher.h>
12
#include <botan/secmem.h>
13

14
namespace Botan {
15

16
/**
17
* Blowfish
18
*/
19
class BOTAN_TEST_API Blowfish final : public Block_Cipher_Fixed_Params<8, 1, 56> {
×
20
   public:
21
      void encrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
22
      void decrypt_n(const uint8_t in[], uint8_t out[], size_t blocks) const override;
23

24
      /**
25
      * Modified EKSBlowfish key schedule, used for bcrypt password hashing
26
      */
27
      void salted_set_key(const uint8_t key[],
28
                          size_t key_length,
29
                          const uint8_t salt[],
30
                          size_t salt_length,
31
                          size_t workfactor,
32
                          bool salt_first = false);
33

34
      void clear() override;
35

36
      std::string name() const override { return "Blowfish"; }
581✔
37

38
      std::unique_ptr<BlockCipher> new_object() const override { return std::make_unique<Blowfish>(); }
274✔
39

40
      bool has_keying_material() const override;
41

42
   private:
43
      void key_schedule(std::span<const uint8_t> key) override;
44

45
      void key_expansion(const uint8_t key[], size_t key_length, const uint8_t salt[], size_t salt_length);
46

47
      void generate_sbox(secure_vector<uint32_t>& box,
48
                         uint32_t& L,
49
                         uint32_t& R,
50
                         const uint8_t salt[],
51
                         size_t salt_length,
52
                         size_t salt_off) const;
53

54
      secure_vector<uint32_t> m_S, m_P;
55
};
56

57
}  // namespace Botan
58

59
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc