I have a string number ranging in uint256, such as "115792089237316195423570985008687907853269984665640564039457584007913129639935". I want to store the bytes of this number into a vector<unsigned char>. That is, I want to get 0xffffff...fff (256bit) stored in the vector, where the vector's size will not be larger than 32 bytes.
I have tried the following ways:
Using
intto receive the string number and transfer, but the number is out of theintrange;Using
boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>. But I do not know how to transfer the string number to this type. I cannot find the details of using this type on the Internet.