I'm doing Elgamal Signature Scheme and I need to use the decimal hash value from the message to compute S for signature generation. An example of the hexadecimal hash is:
820dbb4256a4287557ade2f729d279f1
As you can see above, the hash value is a 32-digits hexadecimal number. I need to transform the string above to decimal integer and use it for calculation later.
string hash = md5(message);
cout << hash << endl;
NTL::ZZ msgHash = strtol(hash.c_str(), NULL, 16);
cout << msgHash << endl;
There are no integer large enough to contain the value of 32 byte hexadecimal hash, and so I tried big integer from NTL library but it didn't work out because you cannot assign the long integer returned from strtol function (And I think the decimal hash value is way longer than long integer range limit) to NTL::ZZ type. Is there any good solution to this?
I'm doing this with visual C++ in Visual Studio 2013.