pub fn generate_computer_id() -> String {
    use sha2::Digest;

    // This is dumb and bad code
    // but more importantly it's dumb and bad code that
    // doesn't make any sense here
    // BECAUSE ON LINUX, WE HAVE /etc/machine-id
    // IN M O S T CASES AND WE SHOULD ONLY BE RUNNING THIS WHEN NOT THAT
    // OH FUCKING WELL THIS CAN STAY RN
    let unique_bytes: [u8; 4] = if cfg!(target_os = "linux") {
        let cmd = std::process::Command::new("uname")
            .arg("-a")
            .output()
            .expect("failed to run uname -a? wtf?");
        let mut sha = sha2::Sha256::new();
        sha.update(cmd.stdout);
        let fin = sha.finalize();
        let mut bytes: [u8; 4] = fin[0..4].try_into().unwrap();

        if let Some(experimental) = &crate::config::CONFIG.experimental {
            if experimental.tweak_computer_id_randomly {
                for i in 0..4 {
                    bytes[i] = bytes[i].wrapping_add(rand::random::<u8>());
                }
            }
        }

        bytes
    } else {
        [0xde, 0xad, 0xc0, 0xde]
    };

    let actual_bytes = {
        let mut fuck: [u8; 5] = [0, 0, 0, 0, 0];
        fuck[1..].clone_from_slice(&unique_bytes);
        let checksum = (-((fuck[1].overflowing_add(fuck[2]).0.overflowing_add(fuck[3]).0.overflowing_add(fuck[4])).0 as i64)) as u8;
        fuck[0] = checksum;
        fuck
    };

    hex::encode(actual_bytes)
}
/// Square Enix wants a unique computer ID
/// so this is how I generate one
Square Enix wants a unique computer ID
so this is how I generate one
Square Enix wants a unique computer ID so this is how I generate one
pub fn generate_computer_id() -> String {
    use sha2::Digest;
    // This is dumb and bad code
    // but more importantly it's dumb and bad code that
    // doesn't make any sense here
    // BECAUSE ON LINUX, WE HAVE /etc/machine-id
    // IN M O S T CASES AND WE SHOULD ONLY BE RUNNING THIS WHEN NOT THAT
    // OH FUCKING WELL THIS CAN STAY RN
    let unique_bytes: [u8; 4] = if cfg!(target_os = "linux") {
        let cmd = std::process::Command::new("uname")
            .arg("-a")
            .output()
            .expect("failed to run uname -a? wtf?");
        let mut sha = sha2::Sha256::new();
        sha.update(cmd.stdout);
        let fin = sha.finalize();
        let mut bytes: [u8; 4] = fin[0..4].try_into().unwrap();
        if let Some(experimental) = &crate::config::CONFIG.experimental {
            if experimental.tweak_computer_id_randomly {
                for i in 0..4 {
                    bytes[i] = bytes[i].wrapping_add(rand::random::<u8>());
                }
            }
        }
        bytes
    } else {
        [0xde, 0xad, 0xc0, 0xde]
    };
    let actual_bytes = {
        let mut fuck: [u8; 5] = [0, 0, 0, 0, 0];
        fuck[1..].clone_from_slice(&unique_bytes);
        let checksum = (-((fuck[1].overflowing_add(fuck[2]).0.overflowing_add(fuck[3]).0.overflowing_add(fuck[4])).0 as i64)) as u8;
        fuck[0] = checksum;
        fuck
    };
    hex::encode(actual_bytes)
}
pub fn generate_computer_id ( ) -> String { use sha2 :: Digest ; // This is dumb and bad code // but more importantly it's dumb and bad code that // doesn't make any sense here // BECAUSE ON LINUX, WE HAVE /etc/machine-id // IN M O S T CASES AND WE SHOULD ONLY BE RUNNING THIS WHEN NOT THAT // OH FUCKING WELL THIS CAN STAY RN let unique_bytes : [ u8 ; 4 ] = if cfg ! ( target_os " " ) { let cmd = std :: process :: Command :: new ( " " ) . arg ( " " ) . output ( ) . expect ( " " ) ; let mut sha = sha2 :: Sha256 :: new ( ) ; sha . update ( cmd . stdout ) ; let fin = sha . finalize ( ) ; let mut bytes : [ u8 ; 4 ] = fin [ 0 .. 4 ] . try_into ( ) . unwrap ( ) ; if let Some ( experimental ) = & crate :: config :: CONFIG . experimental { if experimental . tweak_computer_id_randomly { for i in 0 .. 4 { bytes [ i ] = bytes [ i ] . wrapping_add ( rand :: random :: < u8 > ( ) ) ; } } } bytes } else { [ 0xde , 0xad , 0xc0 , 0xde ] } ; let actual_bytes = { let mut fuck : [ u8 ; 5 ] = [ 0 , 0 , 0 , 0 , 0 ] ; fuck [ 1 .. ] . clone_from_slice ( & unique_bytes ) ; let checksum = ( - ( ( fuck [ 1 ] . overflowing_add ( fuck [ 2 ] ) . 0 . overflowing_add ( fuck [ 3 ] ) . 0 . overflowing_add ( fuck [ 4 ] ) ) . 0 as i64 ) ) as u8 ; fuck [ 0 ] = checksum ; fuck } ; hex :: encode ( actual_bytes ) }
Square Enix wants a unique computer ID
so this is how I generate one
Square Enix wants a unique computer ID so this is how I generate one