🚧 wip: working on avalanche idea to make MACs easier for humans to read
parent
f121e3fd55
commit
d9fd0fd29d
|
@ -0,0 +1,40 @@
|
||||||
|
type Mac = [u8; 6];
|
||||||
|
|
||||||
|
pub fn debug () {
|
||||||
|
for input in [
|
||||||
|
[0, 0, 0, 0, 0, 0],
|
||||||
|
[0, 0, 0, 0, 0, 1],
|
||||||
|
[1, 0, 0, 0, 0, 0],
|
||||||
|
[1, 0, 0, 0, 0, 1],
|
||||||
|
] {
|
||||||
|
assert_eq! (unmix (mix (input)), input);
|
||||||
|
}
|
||||||
|
|
||||||
|
println! ("Passed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOT intended for any cryptography or security. This is TRIVIALLY reversible.
|
||||||
|
// It's just to make it easier for humans to tell apart MACs where only a couple
|
||||||
|
// numbers differ.
|
||||||
|
|
||||||
|
fn mix (i: Mac) -> Mac {
|
||||||
|
[
|
||||||
|
i [0] ^ i [5],
|
||||||
|
i [1] ^ i [4],
|
||||||
|
i [2] ^ i [3],
|
||||||
|
i [3],
|
||||||
|
i [4],
|
||||||
|
i [5],
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn unmix (i: Mac) -> Mac {
|
||||||
|
[
|
||||||
|
i [0] ^ i [5],
|
||||||
|
i [1] ^ i [4],
|
||||||
|
i [2] ^ i [3],
|
||||||
|
i [3],
|
||||||
|
i [4],
|
||||||
|
i [5],
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
|
||||||
pub mod app_common;
|
pub mod app_common;
|
||||||
|
mod avalanche;
|
||||||
mod client;
|
mod client;
|
||||||
mod ip;
|
mod ip;
|
||||||
pub mod message;
|
pub mod message;
|
||||||
|
@ -31,6 +32,7 @@ async fn async_main () -> Result <(), AppError> {
|
||||||
Some ("--version") => println! ("lookaround v{}", LOOKAROUND_VERSION),
|
Some ("--version") => println! ("lookaround v{}", LOOKAROUND_VERSION),
|
||||||
Some ("client") => client::client (args).await?,
|
Some ("client") => client::client (args).await?,
|
||||||
Some ("config") => config (),
|
Some ("config") => config (),
|
||||||
|
Some ("debug-avalanche") => avalanche::debug (),
|
||||||
Some ("find-nick") => client::find_nick (args).await?,
|
Some ("find-nick") => client::find_nick (args).await?,
|
||||||
Some ("my-ips") => my_ips ()?,
|
Some ("my-ips") => my_ips ()?,
|
||||||
Some ("server") => server::server (args).await?,
|
Some ("server") => server::server (args).await?,
|
||||||
|
|
Loading…
Reference in New Issue