add preprocessing to cast hex values to uint256, always produce 64 bytes from setup
This commit is contained in:
parent
234e62134f
commit
922946bdb3
3 changed files with 7 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue