void bn254_fp2_set_str(Element x, const char *s) { int i = 0; int len = strlen(s); char msg[140], *p, *c = NULL; if (len > 140) { fprintf(stderr, "error: input string is too long, string must be smaller than 140\n"); exit(200); } strcpy(msg, s); p = msg; while ((*p) != '\0') { if ((*p) == ' ') { if (i == 0) { c = p; } i++; } p++; } if (i != 1) { fprintf(stderr, "error: input string is not correct\n"); exit(200); } (*c) = '\0'; bn254_fp_set_str(rep0(x), msg); bn254_fp_set_str(rep1(x), ++c); }
void bn254_fp6_set_str(Element x, const char *s) { int i = 0; int len = strlen(s); char msg[400], *p, *c[5]; if (len > 400) { fprintf(stderr, "error: input string is too long, string must be smaller than 400\n"); exit(200); } strcpy(msg, s); p = msg; while ((*p) != '\0') { if ((*p) == ' ') { if (i < 5) { c[i] = p; } i++; } p++; } if (i != 5) { fprintf(stderr, "error: input string is not correct\n"); exit(200); } (*c[0]) = '\0'; (*c[1]) = '\0'; (*c[2]) = '\0'; (*c[3]) = '\0'; (*c[4]) = '\0'; bn254_fp_set_str(rep0(rep0(x)), msg); bn254_fp_set_str(rep0(rep1(x)), ++c[0]); bn254_fp_set_str(rep0(rep2(x)), ++c[1]); bn254_fp_set_str(rep1(rep0(x)), ++c[2]); bn254_fp_set_str(rep1(rep1(x)), ++c[3]); bn254_fp_set_str(rep1(rep2(x)), ++c[4]); }