fn binary_id() -> &'static str {
    use sha2::{Digest, Sha256};
    use std::{env, fs, io};

    static INSTANCE: OnceCell<String> = OnceCell::new();
    INSTANCE.get_or_init(|| {
        let exe_path = env::current_exe().expect("Cannot read own binary to determine binary id");
        let mut exe_file =
            fs::File::open(exe_path).expect("Cannot read own binary to determine binary id");
        let mut hasher = Sha256::new();
        io::copy(&mut exe_file, &mut hasher).expect("Copying data into binary hasher works");
        let hash = hasher.finalize();
        base64::encode(hash)
    })
}
/// Reads own binary, hashes it, and returns b64 str version of that hash
Reads own binary, hashes it, and returns b64 str version of that hash
Reads own binary hashes it and returns b64 str version of that hash
fn binary_id() -> &'static str {
    use sha2::{Digest, Sha256};
    use std::{env, fs, io};
    static INSTANCE: OnceCell<String> = OnceCell::new();
    INSTANCE.get_or_init(|| {
        let exe_path = env::current_exe().expect("Cannot read own binary to determine binary id");
        let mut exe_file =
            fs::File::open(exe_path).expect("Cannot read own binary to determine binary id");
        let mut hasher = Sha256::new();
        io::copy(&mut exe_file, &mut hasher).expect("Copying data into binary hasher works");
        let hash = hasher.finalize();
        base64::encode(hash)
    })
}
fn binary_id ( ) -> & ' static str { use sha2 :: { Digest , Sha256 } ; use std :: { env , fs , io } ; static INSTANCE : OnceCell < String > = OnceCell :: new ( ) ; INSTANCE . get_or_init ( | | { let exe_path = env :: current_exe ( ) . expect ( " " ) ; let mut exe_file = fs :: File :: open ( exe_path ) . expect ( " " ) ; let mut hasher = Sha256 :: new ( ) ; io :: copy ( & mut exe_file , & mut hasher ) . expect ( " " ) ; let hash = hasher . finalize ( ) ; base64 :: encode ( hash ) } ) }
Reads own binary, hashes it, and returns b64 str version of that hash
Reads own binary hashes it and returns b64 str version of that hash