68aef942f5dce22319f208fedd72cce39f0f03da
[crypto_lab1.git] / lab1_rust / src / oracle_machine.rs
1 use std::io;
2 use std::io::{ TcpStream };
3 use end_point::EndPoint;
4
5 /// Try to decypher a cyphered data block by using an oracle on the provided address and port.
6 /// May prints some message on the stdout.
7 pub fn decypher(address: &str, port: u16, cypherblock: [u8, ..16]) -> Option<Vec<u8>> {
8 let end_point = EndPoint::new(
9 match TcpStream::connect(address, port) {
10 Ok(s) => s,
11 _ => {
12 println!("Unable to connect to the oracle on {}:{}", address, port);
13 return None
14 }
15 }
16 );
17
18 None
19 }