Minor code style

This commit is contained in:
poma 2020-01-08 19:41:48 +07:00
parent 7dd44484e2
commit b6945b6029
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
6 changed files with 35 additions and 35 deletions

@ -64,7 +64,7 @@ fn main() {
for b in cur_hash.iter() {
print!("{:02x}", b);
}
println!("");
println!();
let mut digest = &cur_hash[..];

@ -51,7 +51,7 @@ fn main() {
let mut cur_hash: [u8; 32] = hex!("0000000000000000000a558a61ddc8ee4e488d647a747fe4dcc362fe2026c620");
// Performs 2^n hash iterations over it
const N: usize = 10;
const N: u64 = 10;
for i in 0..(1u64<<N) {
// Print 1024 of the interstitial states
@ -63,7 +63,7 @@ fn main() {
for b in cur_hash.iter() {
print!("{:02x}", b);
}
println!("");
println!();
}
let mut h = Sha256::new();
@ -75,7 +75,7 @@ fn main() {
for b in cur_hash.iter() {
print!("{:02x}", b);
}
println!("");
println!();
let mut digest = &cur_hash[..];
@ -91,7 +91,7 @@ fn main() {
// Try to load challenge file from disk.
let reader = OpenOptions::new()
.read(true)
.read(true)
.open(challenge_filename)
.expect("unable open challenge file in this directory");
@ -115,9 +115,9 @@ fn main() {
// Create response file in this directory
let writer = OpenOptions::new()
.read(true)
.write(true)
.create_new(true)
.read(true)
.write(true)
.create_new(true)
.open(response_filename)
.expect("unable to create response file in this directory");
@ -148,7 +148,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
(&mut writable_map[0..]).write(current_accumulator_hash.as_slice()).expect("unable to write a challenge hash to mmap");
@ -192,7 +192,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
println!("Thank you for your participation, much appreciated! :)");

@ -132,7 +132,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
(&mut writable_map[0..]).write(current_accumulator_hash.as_slice()).expect("unable to write a challenge hash to mmap");
@ -197,7 +197,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
println!("Thank you for your participation, much appreciated! :)");

@ -61,7 +61,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
BachedAccumulator::<Bn256, Bn256CeremonyParameters>::generate_initial(&mut writable_map, COMPRESS_NEW_CHALLENGE).expect("generation of initial accumulator is successful");
@ -81,7 +81,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
println!("Wrote a fresh accumulator to challenge file");

@ -155,9 +155,9 @@ fn new_accumulator_for_verify() -> BachedAccumulator<Bn256, Bn256CeremonyParamet
}
let file = OpenOptions::new()
.read(true)
.write(true)
.create_new(true)
.read(true)
.write(true)
.create_new(true)
.open(file_name)
.expect("unable to create `./tmp_initial_challenge`");
@ -170,8 +170,8 @@ fn new_accumulator_for_verify() -> BachedAccumulator<Bn256, Bn256CeremonyParamet
}
let reader = OpenOptions::new()
.read(true)
.open(file_name)
.read(true)
.open(file_name)
.expect("unable open transcript file in this directory");
let readable_map = unsafe { MmapOptions::new().map(&reader).expect("unable to create a memory map for input") };
@ -194,7 +194,7 @@ fn main() {
// Try to load transcript file from disk.
let reader = OpenOptions::new()
.read(true)
.read(true)
.open(transcript_filename)
.expect("unable open transcript file in this directory");
@ -274,7 +274,7 @@ fn main() {
println!(" ... FAILED");
panic!("INVALID RESPONSE FILE!");
} else {
println!("");
println!();
}
current_accumulator = response_file_accumulator;
@ -376,11 +376,11 @@ fn main() {
// Create the parameter file
let writer = OpenOptions::new()
.read(false)
.write(true)
.create_new(true)
.open(paramname)
.expect("unable to create parameter file in this directory");
.read(false)
.write(true)
.create_new(true)
.open(paramname)
.expect("unable to create parameter file in this directory");
let mut writer = BufWriter::new(writer);

@ -36,7 +36,7 @@ fn main() {
// Try to load challenge file from disk.
let challenge_reader = OpenOptions::new()
.read(true)
.read(true)
.open(challenge_filename)
.expect("unable open challenge file in this directory");
@ -59,7 +59,7 @@ fn main() {
// Try to load response file from disk.
let response_reader = OpenOptions::new()
.read(true)
.read(true)
.open(response_filename)
.expect("unable open response file in this directory");
@ -95,7 +95,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
// Check the hash chain - a new response must be based on the previous challenge!
@ -113,7 +113,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
if &response_challenge_hash[..] != current_accumulator_hash.as_slice() {
@ -132,7 +132,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
// get the contributor's public key
@ -169,9 +169,9 @@ fn main() {
// Create new challenge file in this directory
let writer = OpenOptions::new()
.read(true)
.write(true)
.create_new(true)
.read(true)
.write(true)
.create_new(true)
.open(new_challenge_filename)
.expect("unable to create new challenge file in this directory");
@ -209,7 +209,7 @@ fn main() {
}
print!(" ");
}
println!("");
println!();
}
println!("Done! new challenge file contains the new challenge file. The other files");