extern crate clap; extern crate time; use clap::{Arg, App, SubCommand}; mod hasher_sha256; mod hash256; pub fn main(/*base: usize, */number: usize, diff: String) { let matches = create_app().get_matches(); let base; match matches.value_of("base") { Some(x) => {base = u64::from(x)} None => {panic!()} }; match hash256::verify_product(base, number, diff) { Some(x) => { println!("{}", diff); } None => { println!("None"); } } } fn create_app<'a, 'b>() -> App<'a, 'b> { App::new("Hash256") .version("1.0") .author("Lorenz Bung & Joshua Rutschmann") .about("Calculates the Hashvalue of the given base, number and difficulty.") .arg(Arg::with_name("base") .short("b") .long("base") .value_name("VALUE") .help("The base of the hash to be calculated on.") .takes_value(true) .required(true)) .arg(Arg::with_name("number") .short("n") .long("number") .value_name("VALUE") .help("The number of the hash to be calculated on.") .takes_value(true) .required(true)) .arg(Arg::with_name("difficulty") .short("d") .long("difficulty") .value_name("VALUE") .help("The difficulty of the calculated hash.") .takes_value(true) .required(true)) .subcommand(SubCommand::with_name("timings") .about("controls timing features") .version("1.0") .author("Lorenz Bung & Joshua Rutschmann")) }