use core::panic;
use sha2::{Digest, Sha256};
use std::{
    fs::{File, create_dir_all},
    io::{BufReader, Read},
};

#[cfg(not(target_os = "linux"))]
compile_error!("kitty like linux more");

fn hashcat() {
    let file = File::open("cat_01.jpg").expect("how dare u! i want my cat back :(");
    let mut cat = BufReader::new(file);

    let mut hasher = Sha256::new();

    let mut buffer = [0u8; 4096];
    loop {
        let bytes_read = cat.read(&mut buffer).expect("what happened to my cat!?");
        if bytes_read == 0 {
            break;
        }
        hasher.update(&buffer[..bytes_read]);
    }

    let file_hash = hex::encode(hasher.finalize());

    if !file_hash
        .eq_ignore_ascii_case("45d4cf2fb11999c39ec5cd0cbedb436767421c8b8dab575c76f0b6ad9265d640")
    {
        panic!("this is not my cat. where is my cat. what did you do!? KITTYYYYYYYYYY")
    }
}

fn main() {
    hashcat(); // meow
    let timbre_dir = std::env::home_dir()
        .expect("NERD!!!")
        .join("Music")
        .join("Timbre");
    create_dir_all(timbre_dir).expect("wat");
}
