Advertisement
Hygcgggnngff

fps dropper anti cheat

Sep 28th, 2024 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 KB | None | 0 0
  1. using System.IO;
  2. using System.Security.Cryptography;
  3. using UnityEngine;
  4.  
  5. public class FileEncryption : MonoBehaviour
  6. {
  7.     private string encryptionKey = "your_secure_key";
  8.  
  9.     void Start()
  10.     {
  11.         string filePath = Application.dataPath + "/YourImportantFile.txt";
  12.         EncryptFile(filePath);
  13.         DecryptFile(filePath);
  14.     }
  15.  
  16.     void EncryptFile(string filePath)
  17.     {
  18.         try
  19.         {
  20.             using (Aes aes = Aes.Create())
  21.             {
  22.                 aes.Key = System.Text.Encoding.UTF8.GetBytes(encryptionKey.PadRight(32));
  23.                 aes.IV = new byte[16]; // 16 bytes for AES initialization vector (can be random)
  24.  
  25.                 using (FileStream fileStream = new FileStream(filePath, FileMode.OpenOrCreate))
  26.                 using (CryptoStream cryptoStream = new CryptoStream(fileStream, aes.CreateEncryptor(), CryptoStreamMode.Write))
  27.                 {
  28.                     byte[] fileBytes = File.ReadAllBytes(filePath);
  29.                     cryptoStream.Write(fileBytes, 0, fileBytes.Length);
  30.                 }
  31.             }
  32.  
  33.             Debug.Log("File encrypted.");
  34.         }
  35.         catch (System.Exception e)
  36.         {
  37.             Debug.LogError("Error encrypting file: " + e.Message);
  38.         }
  39.     }
  40.  
  41.     void DecryptFile(string filePath)
  42.     {
  43.         try
  44.         {
  45.             using (Aes aes = Aes.Create())
  46.             {
  47.                 aes.Key = System.Text.Encoding.UTF8.GetBytes(encryptionKey.PadRight(32));
  48.                 aes.IV = new byte[16];
  49.  
  50.                 using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
  51.                 using (CryptoStream cryptoStream = new CryptoStream(fileStream, aes.CreateDecryptor(), CryptoStreamMode.Read))
  52.                 {
  53.                     byte[] fileBytes = new byte[fileStream.Length];
  54.                     cryptoStream.Read(fileBytes, 0, fileBytes.Length);
  55.                     File.WriteAllBytes(filePath, fileBytes);
  56.                 }
  57.             }
  58.  
  59.             Debug.Log("File decrypted.");
  60.         }
  61.         catch
  62.  
Tags: anti cheat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement