phrocker commented on a change in pull request #690: MINIFICPP-1026 - Added 
base64 encoder-decoder to StringUtils
URL: https://github.com/apache/nifi-minifi-cpp/pull/690#discussion_r354288281
 
 

 ##########
 File path: libminifi/include/utils/StringUtils.h
 ##########
 @@ -330,6 +336,194 @@ class StringUtils {
     return to_hex(reinterpret_cast<const uint8_t*>(str.data()), str.length(), 
uppercase);
   }
 
+  /**
+   * Hexencodes a vector of bytes
+   * @param data the vector of bytes to be hexencoded
+   * @param uppercase whether the hexencoded string should be upper case
+   * @return the hexencoded string
+   */
+  inline static std::string to_hex(const std::vector<uint8_t>& data, bool 
uppercase = false) {
+    return to_hex(data.data(), data.size(), uppercase);
+  }
+
+  /**
+   * Decodes the Base64 encoded string into data
+   * @param data the output buffer where the decoded bytes will be written. 
Must be at least (base64_length / 4 + 1) * 3 bytes long.
+   * @param data_length pointer to the length of data the data buffer. It will 
be filled with the length of the decoded bytes.
+   * @param base64 the Base64 encoded string
+   * @param base64_length the length of base64
+   * @return true on success
+   */
+  inline static bool from_base64(uint8_t* data, size_t* data_length, const 
char* base64, size_t base64_length) {
 
 Review comment:
   Is this your own impl or a copy and paste?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to