I have string of hexadecimals which I need to convert to const byte*
. I am using Crypto++ to do hashing and it needs the key to be in const byte*
Is there any way i can convert the string of hexadecimal into const byte*
using any of the Crypto++ libs or must i need to come up with my own?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Working with hmacsha256 in windows store app
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
There is a
HexDecoder
class in Crypto++.You need to feed this characters. It seems that Crypto++ does not directly distinguish between characters and bytes. So the following line of code supplied by varren will work:
You should use a HexDecoder and ArraySink then. Something like:
You can then use the byte array
decoded.get()
as abyte*
.You can also use a
vector<byte>
. In this case, thebyte*
is&v[0]
. Something like:This is even easier:
If you want the non-const version then use: