diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..011b132 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/target +/download +/tmp +public_data +secret_data \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 9ee5187..2cecd4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,7 +49,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ - "libc 0.2.155", + "libc", ] [[package]] @@ -76,7 +76,7 @@ dependencies = [ "addr2line", "cc", "cfg-if 1.0.0", - "libc 0.2.155", + "libc", "miniz_oxide", "object", "rustc-demangle", @@ -160,7 +160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" dependencies = [ "jobserver", - "libc 0.2.155", + "libc", "once_cell", ] @@ -215,7 +215,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c7080e711c39c3dda834604f7c31f4634a38b8dddeb9f24db5d7801751415ad" dependencies = [ "aes", - "libc 0.2.155", + "libc", "rayon", ] @@ -268,7 +268,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", - "libc 0.2.155", + "libc", ] [[package]] @@ -283,7 +283,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ - "libc 0.2.155", + "libc", ] [[package]] @@ -471,7 +471,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "libc 0.2.155", + "libc", "windows-sys 0.52.0", ] @@ -598,7 +598,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if 1.0.0", - "libc 0.2.155", + "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -923,7 +923,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" dependencies = [ - "libc 0.2.155", + "libc", ] [[package]] @@ -953,7 +953,7 @@ version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ - "libc 0.2.155", + "libc", ] [[package]] @@ -981,12 +981,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "libc" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122" - [[package]] name = "libc" version = "0.2.155" @@ -1099,7 +1093,7 @@ dependencies = [ "fuchsia-zircon-sys", "iovec", "kernel32-sys", - "libc 0.2.155", + "libc", "log", "miow", "net2", @@ -1113,7 +1107,7 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ - "libc 0.2.155", + "libc", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -1136,7 +1130,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "libc 0.2.155", + "libc", "log", "openssl", "openssl-probe", @@ -1154,7 +1148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" dependencies = [ "cfg-if 0.1.10", - "libc 0.2.155", + "libc", "winapi 0.3.9", ] @@ -1191,7 +1185,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", - "libc 0.2.155", + "libc", ] [[package]] @@ -1218,7 +1212,7 @@ dependencies = [ "bitflags 2.5.0", "cfg-if 1.0.0", "foreign-types", - "libc 0.2.155", + "libc", "once_cell", "openssl-macros", "openssl-sys", @@ -1248,7 +1242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", - "libc 0.2.155", + "libc", "pkg-config", "vcpkg", ] @@ -1282,7 +1276,7 @@ checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" dependencies = [ "cfg-if 0.1.10", "cloudabi", - "libc 0.2.155", + "libc", "redox_syscall 0.1.57", "rustc_version", "smallvec 0.6.14", @@ -1296,7 +1290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if 1.0.0", - "libc 0.2.155", + "libc", "redox_syscall 0.5.2", "smallvec 1.13.2", "windows-targets 0.52.5", @@ -1385,7 +1379,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ "autocfg 0.1.8", - "libc 0.2.155", + "libc", "rand_chacha", "rand_core 0.4.2", "rand_hc", @@ -1455,7 +1449,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ - "libc 0.2.155", + "libc", "rand_core 0.4.2", "winapi 0.3.9", ] @@ -1468,7 +1462,7 @@ checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ "cloudabi", "fuchsia-cprng", - "libc 0.2.155", + "libc", "rand_core 0.4.2", "rdrand", "winapi 0.3.9", @@ -1579,12 +1573,23 @@ dependencies = [ [[package]] name = "rpassword" -version = "0.0.4" +version = "7.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a9dde63c78217c24d7f16dc1d60aac012124ba29d7bfa71bda532d4de668f44" +checksum = "80472be3c897911d0137b2d2b9055faf6eeac5b14e324073d83bc17b191d7e3f" dependencies = [ - "libc 0.1.12", - "termios", + "libc", + "rtoolbox", + "windows-sys 0.48.0", +] + +[[package]] +name = "rtoolbox" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c247d24e63230cdb56463ae328478bd5eac8b8faa8c69461a77e8e323afac90e" +dependencies = [ + "libc", + "windows-sys 0.48.0", ] [[package]] @@ -1610,7 +1615,7 @@ checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", - "libc 0.2.155", + "libc", "linux-raw-sys", "windows-sys 0.52.0", ] @@ -1645,7 +1650,7 @@ dependencies = [ "bitflags 2.5.0", "core-foundation", "core-foundation-sys", - "libc 0.2.155", + "libc", "security-framework-sys", ] @@ -1656,7 +1661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", - "libc 0.2.155", + "libc", ] [[package]] @@ -1760,7 +1765,7 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ - "libc 0.2.155", + "libc", ] [[package]] @@ -1793,7 +1798,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ - "libc 0.2.155", + "libc", "windows-sys 0.52.0", ] @@ -1875,15 +1880,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "termios" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75071a31761781a74d091387713756966a74ce60eea99a093a5ab3f2cccac3fe" -dependencies = [ - "libc 0.1.12", -] - [[package]] name = "tfhe" version = "0.6.3" @@ -1925,7 +1921,7 @@ version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ - "libc 0.2.155", + "libc", "wasi 0.10.0+wasi-snapshot-preview1", "winapi 0.3.9", ] @@ -2013,7 +2009,7 @@ checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes 1.6.0", - "libc 0.2.155", + "libc", "mio 0.8.11", "num_cpus", "parking_lot 0.12.3", diff --git a/Cargo.toml b/Cargo.toml index e6cee14..b5bd1cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,5 +11,5 @@ bincode = "1.3.3" serde_bytes = "0.11.14" serde = "1.0" zstd = "0.13.1" -rpassword = "0.0.4" +rpassword = "7.3" tokio = { version = "1.38.0", features = ["full"] } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index da93850..4057966 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ async fn main() -> Result<(), Box> { async fn calc_phase() -> Result<(), Box> { println!("ローカルデータ読み込み中..."); - let (my_friends, client_key) = load_local_secret_data().await.unwrap(); + let (my_friends, _client_key) = load_local_secret_data().await.unwrap(); println!("相手の暗号化済みフレンドリストの読み込み中..."); let (remote_data, server_keys) = load_remote_data().await.unwrap(); @@ -60,6 +60,13 @@ async fn calc_phase() -> Result<(), Box> { result.push(res.iter().fold(sample.clone(), |acc, x| (acc | x))); } + println!("データの整形中..."); + let serialized_compared_friends: SerializedComparedFriends = SerializedComparedFriends { friends: result.iter().map(|f| SerializedComparedFriend { value: bincode::serialize(f).unwrap() }).collect() }; + + println!("データの保存中..."); + let mut file = File::create("mutual_friends").unwrap(); + bincode::serialize_into(&mut file, &serialized_compared_friends).unwrap(); + Ok(()) } @@ -193,3 +200,14 @@ struct SerializedFriend { #[serde(with = "serde_bytes")] value: Vec, } + +#[derive(Serialize, Deserialize)] +struct SerializedComparedFriends { + friends: Vec, +} + +#[derive(Serialize, Deserialize)] +struct SerializedComparedFriend { + #[serde(with = "serde_bytes")] + value: Vec, +}