Advertisement
Hygcgggnngff

anti cheat info grabber for modders

Sep 28th, 2024 (edited)
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System.IO;
  2. using System.Security.Cryptography;
  3. using UnityEngine;
  4.  
  5. public class FileIntegrityChecker : MonoBehaviour
  6. {
  7.     // Pre-calculated hashes of original game files
  8.     private string originalFileHash = "your_precomputed_hash_here";
  9.  
  10.     void Start()
  11.     {
  12.         // Path to the file you want to check (e.g., a critical config or data file)
  13.         string filePath = Application.dataPath + "/YourImportantFile.txt";
  14.  
  15.         // Check if the file's hash matches the original hash
  16.         if (!CheckFileIntegrity(filePath))
  17.         {
  18.             Debug.LogError("File integrity check failed! Exiting game.");
  19.             Application.Quit(); // Optionally exit the game or take action
  20.         }
  21.         else
  22.         {
  23.             Debug.Log("File integrity verified.");
  24.         }
  25.     }
  26.  
  27.     bool CheckFileIntegrity(string filePath)
  28.     {
  29.         // Generate the SHA-256 hash of the file
  30.         try
  31.         {
  32.             using (SHA256 sha256 = SHA256.Create())
  33.        
  34.  
Tags: Anti
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement