Stream Conversions Manual

About

The maxon::StreamConversionInterface provides a generic interface for any kind of data conversion. This includes string encoding, compression, encryption, hashing etc.

StreamConversionInterface

Conversion

maxon::StreamConversionInterface is used to convert the given source data. The result of this conversion is typically stored in a given array.

Note
A maxon::StreamConversionInterface object can be used only once.

Streams

A given conversion instance can be converted to an input stream. See InputStream Manual.

Properties

Various properties of the given conversion type can be accessed with:

Conversions

Existing conversions are registered at the registry maxon::StreamConversions or presented as published objects. Some conversions can be configured by defining some settings in a maxon::DataDictionary that is used with the Create() function (maxon::StreamConversionFactory).

Hex

Arbitrary data can be converted to a hexadecimal representation:

  • maxon::StreamConversions::HexEncoder: Hexadecimal encoder.
  • maxon::StreamConversions::HexDecoder: Hexadecimal decoder.

See also maxon::GetHexadecimalValue().

UTF

Text can be converted to different Unicode encodings. See maxon::UTFTEXT_OPTIONS.

  • maxon::StreamConversions::UtfTextEncoder: Unicode encoder.
  • maxon::StreamConversions::UtfTextDecoder: Unicode decoder.

Additional string conversions are registered at maxon::StringEncodings and maxon::StringDecodings, see stringencoding.h. For string conversions there are also maxon::StringEncodingInterface and maxon::StringDecodingInterface.

Base64

Arbitrary data can be converted to a Base64 representation. See maxon::BASE64_OPTIONS.

  • maxon::StreamConversions::Base64Encoder: Base64 encoder.
  • maxon::StreamConversions::Base64Decoder: Base64 decoder.
  • maxon::StreamConversions::Base64UrlEncoder: Base64 URL encoder.
  • maxon::StreamConversions::Base64UrlDecoder: Base64 URL decoder.

Cryptography

Arbitrary data can be encrypted using these algorithms:

  • maxon::StreamConversions::AesEncoder: AES encryption.
  • maxon::StreamConversions::AesDecoder: AES decryption.
  • maxon::StreamConversions::BlowfishEncoder: Blowfish encryption.
  • maxon::StreamConversions::BlowfishDecoder: Blowfish decryption.
  • maxon::StreamConversions::BlowfishLegacyEncoder: Legacy Blowfish encryption.
  • maxon::StreamConversions::BlowfishLegacyDecoder: Legacy Blowfish decryption.
  • maxon::StreamConversions::BlowfishLegacyEnDecoder: Legacy Blowfish en/decryption. See maxon::BLOWFISHLEGACYENDECODER_OPTIONS.

The cryptographic key is set as maxon::CryptographyOptions::CRYPTOKEY using maxon::CryptoKeyInterface. To pad a data block with arbitrary data use maxon::SecureRandom.

Encryption algorithms can also be used with the specialized maxon::CryptographyStreamConversionInterface.

Hashes

Hash values for arbitrary data are calculated with these algorithms:

  • maxon::StreamConversions::HashMD5: MD5 hash algorithm.
  • maxon::StreamConversions::HashSHA1: SHA1 hash algorithm.
  • maxon::StreamConversions::HashSHA256: SHA256 hash algorithm.
  • maxon::StreamConversions::HashSHA512: SHA512 hash algorithm.
  • maxon::StreamConversions::HashCrc32c: Crc32c hash algorithm. For convenience see also maxon::Crc32C.
  • maxon::StreamConversions::HashCrc32zip: Crc32zip hash algorithm.
  • maxon::StreamConversions::HashHmac: Hash-based message authentication code. See maxon::HASH_HMAC.

For easily handling passwords and hash strings see

Compression

Arbitrary data can be compressed using these algorithms. See datacompression.h:

Note
For creating ZIP archives see Archives Manual.

Further Reading