X-Git-Url: http://git.euphorik.ch/?p=crypto_lab1.git;a=blobdiff_plain;f=lab1_rust%2Fsrc%2Foracle_machine.rs;fp=lab1_rust%2Fsrc%2Foracle_machine.rs;h=68aef942f5dce22319f208fedd72cce39f0f03da;hp=0000000000000000000000000000000000000000;hb=ecdec5bf7022018eadf4a38b01890bbb3ab79c89;hpb=c9318a07ce0ec00f999ff17943b83048d536ecd1 diff --git a/lab1_rust/src/oracle_machine.rs b/lab1_rust/src/oracle_machine.rs new file mode 100644 index 0000000..68aef94 --- /dev/null +++ b/lab1_rust/src/oracle_machine.rs @@ -0,0 +1,19 @@ +use std::io; +use std::io::{ TcpStream }; +use end_point::EndPoint; + +/// Try to decypher a cyphered data block by using an oracle on the provided address and port. +/// May prints some message on the stdout. +pub fn decypher(address: &str, port: u16, cypherblock: [u8, ..16]) -> Option> { + let end_point = EndPoint::new( + match TcpStream::connect(address, port) { + Ok(s) => s, + _ => { + println!("Unable to connect to the oracle on {}:{}", address, port); + return None + } + } + ); + + None +}