我正在尝试使用OpenSSL库将表示大整数的字符串p_str
转换为BIGNUM
p
。
#include <stdio.h>
#include <openssl/bn.h>
int main ()
{
/* I shortened the integer */
unsigned char *p_str = "82019154470699086128524248488673846867876336512717";
BIGNUM *p = BN_bin2bn(p_str, sizeof(p_str), NULL);
BN_print_fp(stdout, p);
puts("");
BN_free(p);
return 0;
}
使用以下方式进行编译:
gcc -Wall -Wextra -g -o convert convert.c -lcrypto
但是,当我执行它时,我得到了以下结果:
3832303139313534