I've been searching for hours today and just can't find anything that works out for me. The one I've just had a look at, with no luck, is "How to convert UTF-8 encoded std::string to UTF-16 std::string".
My question is, with a brief explanation:
I want to make a valid NTLM hash in std C++, and I'm using OpenSSL's library to create the hash using its MD4 routines. I know how to do that, so does anyone know how to convert the std::string into a UTF-16 LE encoded string which I can pass to the MD4 functions to get a correct digest?
So, can I have a std::string which holds the char type, and convert it to a UTF16-LE encoded variable length std::string_type? Whether that be std::u16string, or std::wstring?
And would I use s.c_str() or s.data() and would the length() function report correctly in both cases?
std::u16string, not astd::string? -- Could you please focus down the question? It's a bit all over the place right now.length()will always correctly return the number of char-type elements in the string object --charforstd::string,char16_tforstd::u16string,wchar_tforstd::wstring. None of those (necessarily) equals the number of code units / code points, of course. ;-)