How to encrypt and decrypt file

fn main() {
  println!("Master password >>");

  let mut f = OpenOptions::new()
  .create(true)
  .append(true)
  .open("account.txt")
  .expect("Can't open the file");

  const account = "test";
  f.write(account.as_bytes()).expect("Can't write in the file");

}

What i want is to encrypt this account.txt file, and when user type the right password, decrypt account.txt file