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.

38 lines
1.3 KiB

  1. #ifndef CRYPTOPP_BASE32_H
  2. #define CRYPTOPP_BASE32_H
  3. #include "basecode.h"
  4. NAMESPACE_BEGIN(CryptoPP)
  5. //! Converts given data to base 32, the default code is based on draft-ietf-idn-dude-02.txt
  6. /*! To specify alternative code, call Initialize() with EncodingLookupArray parameter. */
  7. class Base32Encoder : public SimpleProxyFilter
  8. {
  9. public:
  10. Base32Encoder(BufferedTransformation *attachment = NULL, bool uppercase = true, int outputGroupSize = 0, const std::string &separator = ":", const std::string &terminator = "")
  11. : SimpleProxyFilter(new BaseN_Encoder(new Grouper), attachment)
  12. {
  13. IsolatedInitialize(MakeParameters(Name::Uppercase(), uppercase)(Name::GroupSize(), outputGroupSize)(Name::Separator(), ConstByteArrayParameter(separator)));
  14. }
  15. void IsolatedInitialize(const NameValuePairs &parameters);
  16. };
  17. //! Decode base 32 data back to bytes, the default code is based on draft-ietf-idn-dude-02.txt
  18. /*! To specify alternative code, call Initialize() with DecodingLookupArray parameter. */
  19. class Base32Decoder : public BaseN_Decoder
  20. {
  21. public:
  22. Base32Decoder(BufferedTransformation *attachment = NULL)
  23. : BaseN_Decoder(GetDefaultDecodingLookupArray(), 5, attachment) {}
  24. void IsolatedInitialize(const NameValuePairs &parameters);
  25. private:
  26. static const int * CRYPTOPP_API GetDefaultDecodingLookupArray();
  27. };
  28. NAMESPACE_END
  29. #endif