From 811215cadcbda2ed1962ed6f51400c8fe8fa7bca Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 21 Mar 2018 01:13:31 -0700 Subject: [PATCH] Verify the challenge file exists before asking user to input randomness. --- src/bin/compute.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bin/compute.rs b/src/bin/compute.rs index 955dd83..a703305 100644 --- a/src/bin/compute.rs +++ b/src/bin/compute.rs @@ -7,8 +7,17 @@ use powersoftau::*; use std::fs::OpenOptions; use std::io::{self, Read, BufReader, Write, BufWriter}; +use std::path::Path; +use std::process; fn main() { + + // Check that the user placed the challenge file into the local directory + if !Path::new("./challenge").exists() { + println!("Error: ./challenge file not found."); + process::exit(1); + } + // Create an RNG based on a mixture of system randomness and user provided randomness let mut rng = { use byteorder::{ReadBytesExt, BigEndian};