Eonirr

Untitled

Mar 29th, 2026
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. string ComputeHash(string truc)
  2. {
  3. using (var sha = SHA256.Create())
  4. {
  5. byte[] bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(truc));
  6. return System.Convert.ToBase64String(bytes);
  7. }
  8. }
  9.  
  10. string json = JsonUtility.ToJson(data);
  11. string newHash = ComputeHash(json);
  12.  
  13. if (newHash != lastSavedHash)
  14. {
  15. File.WriteAllText(path, json);
  16. lastSavedHash = newHash;
  17. }
Add Comment
Please, Sign In to add comment