On Sat, Jul 11, 2020 at 6:46 PM Richard Závodný
<zavodnyrich...@gmail.com> wrote:
>
> I'm looking to way to encode boost::asio::ip::address_v4 using Crypto++ 
> Base32 or Base64 encoders. The problem is that the Base32/64 takes const char 
> *, while the address_v4 is represented by two kind of types, the "bytes_type" 
> which is array<unsigned char, 4> or "uint_type" which is uint_least32_t. I 
> don't know how to convert, and found nothing on the net.

Take the address of the first element and the size. Something like:

    array<unsigned char, 4> addr = ...;
    const unsigned char* ptr = &addr[0];
    size_t size = addr.size();

Then you can use ptr and size in the fourth constructor to a
StringSource. The fourth constructor takes a byte* and size. Also see
https://www.cryptopp.com/wiki/StringSource.

Jeff

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cryptopp-users/CAH8yC8%3D7xBM%3DG581zksr07_DqGtL%2BhqD8GOX%3DpqybDdzVLhteg%40mail.gmail.com.

Reply via email to