Advertisement
saleks28

hash_function2

Jan 10th, 2021
1,056
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | None | 0 0
  1. ///@file Объявление класса для SP-криптосистемы
  2. ///
  3. #include <iostream>
  4. #include <string>
  5. #include <vector>
  6. #include <fstream>
  7. #include <Windows.h>
  8.  
  9. ///@brief Класс для криптосистемы Фейстеля с отбеливанием:
  10. ///
  11. class CryptoSystem
  12. {
  13. public:
  14.      CryptoSystem( const std::vector<uint8_t>& S, const uint32_t& key );
  15.  
  16.      ///@brief Перевод std::vector<uint8_t>(4) sв uint32_t
  17.      ///
  18.      uint32_t FormBlock( const std::vector<uint8_t>& bytes );
  19.  
  20.      ///@brief Перевод uint32_t в std::vector<uint8_t>(4)
  21.      ///
  22.      std::vector<uint8_t> DeformBlock( const uint32_t& block );
  23.  
  24.      ///@brief Функция шифрования блока
  25.      ///
  26.      uint32_t EncryptBlock( const uint32_t& block, uint32_t key );
  27.  
  28.      ///@brief Функция шифрования исходного текста
  29.      ///
  30.      uint32_t EncryptText( std::vector<uint8_t> sourceText );
  31.  
  32.      ///@brief Раунд КС Фейстеля
  33.      ///
  34.      uint32_t FeistelRound( const uint32_t& block, const uint16_t& roundKey );
  35.  
  36.      ///@brief SP-блок
  37.      ///
  38.      uint32_t SP( const uint16_t& x, const uint16_t& roundKey );
  39. private:
  40.      std::vector<uint8_t> S_;
  41.      uint32_t feistelKey_;
  42. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement