开发者

Converting Base64 to GMP integer

I have a scenario where the I get a Base64 (64 bit encoded) string. My requirement is to convert this string to gmp integer (mpz_t).

But according to GMP manual only "The base may vary from 2 to 62" for the function mpz_set_str() .

Is there any approach I can f开发者_如何学Goollow to perform a successful conversion? One idea that struck me was to convert the Base64 to binary and then set the mpz_t variable using mpz_set_str with base 2.

Help would be really appreciated. Thanks.


GMP bases are not the same thing as base64 encoding. You're on the right track - apply the base64 decode, then use mpz_import on the result.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜