From 6c19e9f29460ae034c735d8d5b925f93ecd7ac3b Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 13 Apr 2020 19:25:55 +0300 Subject: [PATCH] fix hex --- powersoftau/Cargo.lock | 7 +++++++ powersoftau/Cargo.toml | 1 + powersoftau/src/bin/beacon_constrained.rs | 8 +++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/powersoftau/Cargo.lock b/powersoftau/Cargo.lock index 8bb4092..74e7a74 100644 --- a/powersoftau/Cargo.lock +++ b/powersoftau/Cargo.lock @@ -214,6 +214,11 @@ name = "hex" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "hex" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "hex-literal" version = "0.1.4" @@ -325,6 +330,7 @@ dependencies = [ "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "exitcode 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -514,6 +520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" "checksum hex-literal 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc2928beef125e519d69ae1baa8c37ea2e0d3848545217f6db0179c5eb1d639" "checksum hex-literal-impl 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d340b6514f232f6db1bd16db65302a5278a04fef9ce867cb932e7e5fa21130a" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" diff --git a/powersoftau/Cargo.toml b/powersoftau/Cargo.toml index 624d3d4..1bc5ff6 100644 --- a/powersoftau/Cargo.toml +++ b/powersoftau/Cargo.toml @@ -21,6 +21,7 @@ byteorder = "1.1.0" hex-literal = "0.1.4" rust-crypto = "0.2" exitcode = "1.1.2" +hex = "0.4.0" memmap = "0.7.0" itertools = "0.8.0" diff --git a/powersoftau/src/bin/beacon_constrained.rs b/powersoftau/src/bin/beacon_constrained.rs index 6b89185..6af6ea9 100644 --- a/powersoftau/src/bin/beacon_constrained.rs +++ b/powersoftau/src/bin/beacon_constrained.rs @@ -1,3 +1,4 @@ +extern crate hex; use powersoftau::{ batched_accumulator::BatchedAccumulator, keypair::keypair, @@ -11,9 +12,6 @@ use std::fs::OpenOptions; use std::io::Write; -#[macro_use] -extern crate hex_literal; - const INPUT_IS_COMPRESSED: UseCompression = UseCompression::No; const COMPRESS_THE_OUTPUT: UseCompression = UseCompression::Yes; const CHECK_INPUT_CORRECTNESS: CheckForCorrectness = CheckForCorrectness::No; @@ -29,7 +27,7 @@ fn main() { let response_filename = &args[2]; let circuit_power = args[3].parse().expect("could not parse circuit power"); let batch_size = args[4].parse().expect("could not parse batch size"); - let beacon_hash = args[5]; + let beacon_hash = &args[5]; let parameters = CeremonyParams::::new(circuit_power, batch_size); @@ -50,7 +48,7 @@ fn main() { use rand::chacha::ChaChaRng; use rand::SeedableRng; - let mut cur_hash: [u8; 32] = hex!(beacon_hash); + let mut cur_hash = hex::decode(beacon_hash).unwrap(); // Performs 2^n hash iterations over it const N: u64 = 10;