how to convert mpz_t to a char variable
Ivan Döbeli
i.doebeli at schwan.ch
Thu Jun 24 08:08:05 UTC 2021
Hello,
how can i convert a mpz_t 16base variable to a char variable to create
the sha256 checksum of it (i wan't to use
https://create.stephan-brumme.com/hash-library/).
thanks in advance for your support.
best regards,
Ivan
#include <gmp.h>
#include <stdio.h>
#include <assert.h>
#include <iostream>
#include <string>
using namespace std;
int main(){
mpz_t n;
int flag;
mpz_init(n);
mpz_set_ui(n,0);
flag =
mpz_set_str(n,"14f8da6389f9c2dd692ddc10aec26db4498f6a787682dd63af59f73e86399923",
16);
unsigned long i;
// for(i=0; i<18446744073709551615UL; i++) {
for(i=0; i<4096; i++) {
gmp_printf("%Zd\n", n);
mpz_add_ui(n,n,1U);
}
mpz_clear(n);
}
More information about the gmp-discuss
mailing list