[R] GMP help - converting rosetta RSA-code to R

Martin Møller Skarbiniks Pedersen tr@xp|@yer @end|ng |rom gm@||@com
Sat Aug 17 11:03:49 CEST 2019


Hi,
    I am trying to make a R version a RosettaCode task involving big number.
    More precise, I am trying to convert the c-solution
http://rosettacode.org/wiki/RSA_code#C
to R.

   These two lines in C gives me problems:
const char *plaintext = "Rossetta Code";
mpz_import(pt, strlen(plaintext), 1, 1, 0, 0, plaintext);

I have tried:
library(gmp)
plaintext <- "Rossetta Code"
as.bigz(charToRaw(plaintext))

and
library(gmp)
plaintext <- "Rossetta Code
as.big(split(plaintext,""))

Thanks for any help/suggestions

Regards
Martin M. S. Pedersen

	[[alternative HTML version deleted]]



More information about the R-help mailing list