Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. #ifndef CRYPTOPP_HEX_H
  2. #define CRYPTOPP_HEX_H
  3. #include "basecode.h"
  4. NAMESPACE_BEGIN(CryptoPP)
  5. //! Converts given data to base 16
  6. class CRYPTOPP_DLL HexEncoder : public SimpleProxyFilter
  7. {
  8. public:
  9. HexEncoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
  10. : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
  11. {
  12. IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator))(Name::Terminator(), ConstByteArrayParameter(terminator)));
  13. }
  14. void IsolatedInitialize(const NameValuePairs &parameters);
  15. };
  16. //! Decode base 16 data back to bytes
  17. class CRYPTOPP_DLL HexDecoder : public BaseN_Decoder
  18. {
  19. public:
  20. HexDecoder(BufferedTransformation *attachment = NULL)
  21. : BaseN_Decoder(GetDefaultDecodingLookupArray(), 4, attachment) {}
  22. void IsolatedInitialize(const NameValuePairs &parameters);
  23. private:
  24. static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
  25. };
  26. NAMESPACE_END
  27. #endif