---
title: "Simple Anti-Tamper - s&box library"
description: "Keep your saves safe from tampering!"
canonical: "https://sbox.watch/libraries/quality/simpleantitamper/"
generated_at: "2026-07-22T23:18:23.253Z"
---

# Simple Anti-Tamper

Keep your saves safe from tampering!

- Type: library
- Ident: quality.simpleantitamper
- Creator: quality
- Canonical: https://sbox.watch/libraries/quality/simpleantitamper/
- Markdown: https://sbox.watch/libraries/quality/simpleantitamper.md
- sbox.game: https://sbox.game/quality/simpleantitamper/
- Generated: 2026-07-22T23:18:23.253Z

## Stats

- 24h momentum: +0
- Terry score: 65%
- Favorites: 2
- Upvotes: 5
- Downvotes: 0
- Updated: Jun 3, 2026
- Created: Feb 16, 2026
- Size: 3.2 KB
- Files: 5
- Tags: 

## Description

public class PlayerData
{
 public int Level { get; set; } // Will be serialized
 public int MaxHealth { get; set; } // Will be serialized
 public string Username; // Won't be serialized

 public static void Save( PlayerData data )
 {
 FileSystem.Data.WriteJson( "player.json", AntiTamper.Lock( data, 1254854 ) );
 }

 public static PlayerData Load()
 {
 return AntiTamper.Unlock(
 FileSystem.Data.ReadJson<LockedData>( "player.json" ),
 1254854,
 new PlayerData()
 );
 }
}
// later...
 try
 {
 data = PlayerData.Load();
 } catch
 {
 Log.Info( "Naughty cheater!" );
 data = new PlayerData();
 }This library serializes your struct as usual, then performs a hash on the string and a magic number you've provided.
When you load the save from the disk, the hash is checked before the object is accepted.

Pick a unique number for your project, but NEVER CHANGE IT! If you do, all old saves will be invalid.

Q: Are my saves actually safe from tampering?
A: Haha, no. This library prevents the most basic tampering where you literally just edit values in the json.
To bypass it, someone would have to open your game code and find the magic number you picked, then do annoying hash calculations themselves.

Sample project: https://nixx.is-fantabulo.us/antitamper.zip



## More by quality

| Package | Ident | Players | Favorites | Upvotes | Score | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Changelog Helper | quality.changeloghelper | 0 | 0 | 0 | -- | https://sbox.watch/libraries/quality/changeloghelper.md |
| Debug Assertions | quality.debugassertions | 0 | 0 | 0 | -- | https://sbox.watch/libraries/quality/debugassertions.md |
