This commit is contained in:
4
school/intro-crypto/uebung/05/p/Cargo.lock
generated
Normal file
4
school/intro-crypto/uebung/05/p/Cargo.lock
generated
Normal file
@ -0,0 +1,4 @@
|
||||
[[package]]
|
||||
name = "p"
|
||||
version = "0.1.0"
|
||||
|
6
school/intro-crypto/uebung/05/p/Cargo.toml
Normal file
6
school/intro-crypto/uebung/05/p/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "p"
|
||||
version = "0.1.0"
|
||||
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||
|
||||
[dependencies]
|
39
school/intro-crypto/uebung/05/p/src/main.rs
Normal file
39
school/intro-crypto/uebung/05/p/src/main.rs
Normal file
@ -0,0 +1,39 @@
|
||||
const P: [usize; 32] = [
|
||||
16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19,
|
||||
13, 30, 6, 22, 11, 4, 25,
|
||||
];
|
||||
|
||||
fn p<T: Copy + Default>(i: [T; 32]) -> [T; 32] {
|
||||
let mut res: [T; 32] = [T::default(); 32];
|
||||
for (i, p) in i.iter().zip(P.iter()) {
|
||||
res[*p - 1] = *i;
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i: [u8; 32] = [
|
||||
1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0,
|
||||
0, 0,
|
||||
];
|
||||
p(i).iter().for_each(|i| print!("{}", i));
|
||||
println!();
|
||||
|
||||
let p = &[
|
||||
true, false, false, false, false, false, true, false, false, true, false, true, true,
|
||||
false, false, true, true, true, false, true, false, true, true, true, false, false, true,
|
||||
true, true, false, true, true,
|
||||
];
|
||||
let l0 = &[
|
||||
true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
|
||||
true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
|
||||
true, true,
|
||||
];
|
||||
|
||||
p.iter()
|
||||
.zip(l0.iter())
|
||||
.map(|(a, b)| a ^ b)
|
||||
.map(|x| if x { '1' } else { '0' })
|
||||
.for_each(|x| print!("{}", x));
|
||||
println!();
|
||||
}
|
1
school/intro-crypto/uebung/05/p/target/.rustc_info.json
Normal file
1
school/intro-crypto/uebung/05/p/target/.rustc_info.json
Normal file
@ -0,0 +1 @@
|
||||
{"rustc_fingerprint":1996615077234892980,"outputs":{"15337506775154344876":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\nunix\n",""],"1617349019360157463":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\nunix\n",""],"1164083562126845933":["rustc 1.30.1 (1433507eb 2018-11-07)\nbinary: rustc\ncommit-hash: 1433507eba7d1a114e4c6f27ae0e1a74f60f20de\ncommit-date: 2018-11-07\nhost: x86_64-unknown-linux-gnu\nrelease: 1.30.1\nLLVM version: 8.0\n",""]},"successes":{}}
|
@ -0,0 +1 @@
|
||||
0727989ce1aa1e48
|
@ -0,0 +1 @@
|
||||
{"rustc":3409524444662720818,"features":"[]","target":6265867820755230167,"profile":8404152588981882898,"path":1036222786711178230,"deps":[],"local":[{"MtimeBased":[[1543354048,10023042],".fingerprint/p-317830ef682f5c46/dep-bin-p-317830ef682f5c46"]}],"rustflags":[],"edition":"Edition2015"}
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
5e32215f8f612020
|
@ -0,0 +1 @@
|
||||
{"rustc":3409524444662720818,"features":"[]","target":6265867820755230167,"profile":256579555595379356,"path":1036222786711178230,"deps":[],"local":[{"MtimeBased":[[1543354051,669476378],".fingerprint/p-a8d68fe4b06c3a8a/dep-bin-p-a8d68fe4b06c3a8a"]}],"rustflags":[],"edition":"Edition2015"}
|
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
/home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/target/debug/deps/p-317830ef682f5c46.rmeta: src/main.rs
|
||||
|
||||
/home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/target/debug/deps/p-317830ef682f5c46.d: src/main.rs
|
||||
|
||||
src/main.rs:
|
BIN
school/intro-crypto/uebung/05/p/target/debug/deps/p-a8d68fe4b06c3a8a
Executable file
BIN
school/intro-crypto/uebung/05/p/target/debug/deps/p-a8d68fe4b06c3a8a
Executable file
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
/home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/target/debug/deps/p-a8d68fe4b06c3a8a: src/main.rs
|
||||
|
||||
/home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/target/debug/deps/p-a8d68fe4b06c3a8a.d: src/main.rs
|
||||
|
||||
src/main.rs:
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
school/intro-crypto/uebung/05/p/target/debug/libp.d
Normal file
1
school/intro-crypto/uebung/05/p/target/debug/libp.d
Normal file
@ -0,0 +1 @@
|
||||
/home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/target/debug/libp.rmeta: /home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/src/main.rs
|
BIN
school/intro-crypto/uebung/05/p/target/debug/p
Executable file
BIN
school/intro-crypto/uebung/05/p/target/debug/p
Executable file
Binary file not shown.
1
school/intro-crypto/uebung/05/p/target/debug/p.d
Normal file
1
school/intro-crypto/uebung/05/p/target/debug/p.d
Normal file
@ -0,0 +1 @@
|
||||
/home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/target/debug/p: /home/me/Dokumente/notes/school/intro-crypto/uebung/05/p/src/main.rs
|
Reference in New Issue
Block a user