1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00

add preprocessing to cast hex values to uint256, always produce 64 bytes from setup

This commit is contained in:
schaeff 2019-03-05 19:51:23 +01:00
parent 234e62134f
commit 922946bdb3
3 changed files with 7 additions and 2 deletions

View file

@ -34,8 +34,7 @@ std::string HexStringFromLibsnarkBigint(libff::bigint<libff::alt_bn128_r_limbs>
ss << std::hex << std::setw(2) << (int)x[i];
}
std::string str = ss.str();
return str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
return ss.str();
}
std::string outputPointG1AffineAsHex(libff::alt_bn128_G1 _p)

View file

@ -183,6 +183,9 @@ impl ProofSystem for GM17 {
.replace(template_text.as_str(), query_repeat_text.as_str())
.into_owned();
let re = Regex::new(r"(?P<v>0[xX][0-9a-fA-F]{64})").unwrap();
template_text = re.replace_all(&template_text, "uint256($v)").to_string();
format!(
"{}{}{}",
SOLIDITY_G2_ADDITION_LIB, SOLIDITY_PAIRING_LIB, template_text

View file

@ -181,6 +181,9 @@ impl ProofSystem for PGHR13 {
.replace(template_text.as_str(), ic_repeat_text.as_str())
.into_owned();
let re = Regex::new(r"(?P<v>0[xX][0-9a-fA-F]{64})").unwrap();
template_text = re.replace_all(&template_text, "uint256($v)").to_string();
format!(
"{}{}{}",
SOLIDITY_G2_ADDITION_LIB, SOLIDITY_PAIRING_LIB, template_text