{"id":13662950,"url":"https://github.com/ookii-tsuki/SafeValues","last_synced_at":"2025-04-25T13:30:47.520Z","repository":{"id":45751670,"uuid":"324421454","full_name":"ookii-tsuki/SafeValues","owner":"ookii-tsuki","description":"A simple Unity library for cheating prevention","archived":false,"fork":false,"pushed_at":"2022-08-19T16:35:57.000Z","size":4312,"stargazers_count":118,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T23:55:27.466Z","etag":null,"topics":["anticheat","gamedev","protection","speedhack","unity","unity3d-plugin"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ookii-tsuki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.TXT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-25T19:30:35.000Z","updated_at":"2024-10-03T15:08:09.000Z","dependencies_parsed_at":"2022-09-22T22:00:44.380Z","dependency_job_id":null,"html_url":"https://github.com/ookii-tsuki/SafeValues","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ookii-tsuki%2FSafeValues","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ookii-tsuki%2FSafeValues/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ookii-tsuki%2FSafeValues/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ookii-tsuki%2FSafeValues/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ookii-tsuki","download_url":"https://codeload.github.com/ookii-tsuki/SafeValues/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223209242,"owners_count":17106814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anticheat","gamedev","protection","speedhack","unity","unity3d-plugin"],"created_at":"2024-08-02T05:02:13.035Z","updated_at":"2024-11-10T19:30:41.399Z","avatar_url":"https://github.com/ookii-tsuki.png","language":"C#","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://i.ibb.co/fDwK75r/Safe-Values-Icon.png\" width=\"300\" alt=\"Safe Values\" /\u003e\n\u003c/p\u003e\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails open=\"open\"\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#demo\"\u003eDemo\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\nThis is a small project I have been working on for anti cheating in Unity Engine.\nIt allows you to protect your game from cheating tools but it doesn't protect its files from being ripped off.\n\n###### Key Features\n   * Hides variables in memory.\n   * Encrypts and extends PlayerPrefs.\n   * Detects speedhacks.\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\n### Installation\n\n* Download the [Latest release](https://github.com/med9999/SafeValues/releases/tag/1.0.1.0) then extract `SfVal.zip` and place the `SfVal.dll` and `SfVal.xml` files in Assets/Plugins of your project.\n* It is recommended to build your game with IL2CPP.\n\n\n\u003c!-- USAGE EXAMPLES --\u003e\n## Usage\n\n### Safe Values\n\n**These structs hide values from cheating tools by making an offset to them**\n\n  * Example of hiding a float/integer from cheating tools.\n   \n    ```csharp\n    using Med.SafeValue;\n    using UnityEngine;\n\n    public class Test : MonoBehaviour\n    {\n        SafeFloat speed = new SafeFloat(500f);\n        SafeInt health = new SafeInt(100);\n        SafeLong plId = new SafeLong(57821103964721L);\n\n        public RigidBody rb;\n\n        public void DealDamage(int amount)\n        {\n            health.Value -= amount;\n        }\n        public long GetID()\n        {\n            return pl.Value;\n        }\n        void Update()\n        {\n            rb.velocity = Vector3.forward * speed.Value * Time.deltaTime;\n        }\n    }\n    ```\n    \n### Player Saves\n\n**This class saves and loads various data types and classes using AES encryption to playerprefs.**\n    \n  * Example of Encrypting/Decrypting and saving/loading a custom serializable class to/from PlayerPrefs using AES encryption\n  \n    ```csharp\n    using Med.SafeValue;\n    using UnityEngine;\n\n    public class Test : MonoBehaviour\n    {\n        public Card card;\n\n        void Awake()\n        {\n            //It is recommanded to set an encryption key, otherwise it is going to use a default key\n            //Warning: always use the same key when encrypting or decrypting\n            PlayerSaves.Key = \"/A?D(G+KbPeShVmYq3t6w9z$C\u0026E)H@Mc\";\n        }\n\n        public void SaveCard()\n        {\n            //will encrypt and save the class in playerprefs\n            PlayerSaves.EncryptClass(card, \"card1\");\n        }\n        public Card LoadCard()\n        {\n            //will load the class from playerprefs and decrypt it\n            return PlayerSaves.DecryptClass\u003cCard\u003e(\"card1\");\n        }\n\n        [System.Serializable]\n        class Card\n        {\n            public string title;\n            public int number;\n            public bool isLegendary;\n        }\n    }\n    ```\n  * Example of Encrypting/Decrypting and saving/loading values to/from PlayerPrefs using AES encryption\n  \n    ```csharp\n    using Med.SafeValue;\n    using UnityEngine;\n    using System;\n\n    public class Test : MonoBehaviour\n    {\n        SafeFloat speed = new SafeFloat(500f);\n        SafeInt health = new SafeInt(100);\n        string title = \"Plane 1\";\n        char plClass = 'C';\n        long id = 15120548466974L;\n        DateTime lastSaved = DateTime.Now;\n        bool isActive = true;\n\n        void Awake()\n        {\n            //It is recommanded to set an encryption key, otherwise it is going to use a default key\n            //Warning: always use the same key when encrypting or decrypting\n            PlayerSaves.Key = \"/A?D(G+KbPeShVmYq3t6w9z$C\u0026E)H@Mc\";\n        }\n\n        public void SaveValues()\n        {\n            //will encrypt these values and save them in playerprefs\n            speed.Value.EncryptFloat(\"plSpeed\");\n            health.Value.EncryptInt(\"plHealth\");\n            title.EncryptString(\"plTitle\");\n            plClass.EncryptChar(\"plClass\");\n            id.EncryptLong(\"plId\");\n            lastSaved.EncryptDateTime(\"plLastSaved\");\n            isActive.EncryptBool(\"plAct\");\n        }\n\n        public void LoadValues()\n        {\n            //will load these values from playerprefs and decrypt them\n            speed.Value = PlayerSaves.DecryptFloat(\"plSpeed\");\n            health.Value = PlayerSaves.DecryptInt(\"plHealth\");\n            title = PlayerSaves.DecryptString(\"plTitle\");\n            plClass = PlayerSaves.DecryptChar(\"plClass\");\n            id = PlayerSaves.DecryptLong(\"plId\");\n            lastSaved = PlayerSaves.DecryptDateTime(\"plLastSaved\");\n            isActive = PlayerSaves.DecryptBool(\"plAct\");\n        }\n    }\n    ```\n### Anti-Speedhack\n\n**This class detects speed hack attempts**\n\n  * Example of setting up an anti speed hack to detect speed hacks\n  \n    ```csharp\n    using Med.SafeValue;\n    using UnityEngine;\n\n    public class Test : MonoBehaviour\n    {\n        void Awake()\n        {\n            //starts the anti speed hack detection process and calls CloseGame() when a speed hack is detected\n            StartCoroutine(AntiSpeedHack.Start(CloseGame, 2f, true));\n        }\n\n        //This will be called if the AntiSpeedHack class detected a speed hack\n        void CloseGame()\n        {\n            Application.Quit();\n        }\n    }\n    ```\n    \n\u003c!-- DEMO --\u003e\n## Demo\n\nTry a WebGL [Demo](https://ookii-tsuki.github.io/SafeValues/index.html)\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n\u003c!-- CONTACT --\u003e\n## Contact\n\nMed Ben Chrifa - mohamed6aminbenchrifa@gmail.com\n\nProject Link: [Safe Values](https://github.com/med9999/SafeValues)\n\n\n","funding_links":[],"categories":["C\\#","Open Source Repositories"],"sub_categories":["Anti-Cheat"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fookii-tsuki%2FSafeValues","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fookii-tsuki%2FSafeValues","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fookii-tsuki%2FSafeValues/lists"}