Garry's Mod

Garry's Mod

30 ratings
Momo's Encryption Library
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
File Size
Posted
Updated
22.074 KB
3 Jun, 2017 @ 7:35pm
25 Feb, 2020 @ 10:35am
4 Change Notes ( view )

Subscribe to download
Momo's Encryption Library

In 4 collections by Cédric GÉRILLE [GiletJaune]
Board Games by Mohamed Rachid
16 items
Soccer by Mohamed RACHID
37 items
Université Joseph Poireau (serveur)
70 items
G-1:788429
50 items
Description
Library to encrypt Lua files or any kind of data

Information
The Wiki of this library[github.com]
Big update: compression is available!
The crash after a few hours is now fixed.

Notes
- Relative Lua paths are not allowed.
- Key: for clientside Lua includes, avoid crazy long keys.
- Using compression is important with the default "msubstract" method while encrypting Lua files and other text-based contents to ensure a reasonable encryption strength.
- This tool allows to encrypt Lua files, but it does not prevent Lua code capture tools from catching decrypted code. So code obfuscation is not useless.

Encryption methods
- "substract" (substract the value of each key byte from the input data) - "msubstract" (same as "substract", but key bytes are multiplied before use)
Other encryption methods will be added later if possible.
free
Functions
momo_encryption.CreateKey( bits )
Generate a key of the given length.
return: (string) random hex string bits: (int) key length in bits
momo_encryption.Encrypt( key, content, compress, method )
Encrypts content with key.
return: (string) encrypted data key: (string) hex string content: (string) clear data compress: (bool) compress data using LZMA (recommended) method: (string) encryption method
momo_encryption.Decrypt( key, encrypted, paranoid, decompress, method )
Decrypts encrypted with key.
return: (string) decrypted data key: (string) hex string encrypted: (string) encrypted data paranoid: (bool) avoid using table.concat() decompress: (bool) decompress data using LZMA method: (string) decryption method
momo_encryption.EncryptFile( key, fileName, path, destination, compress, method )
Encrypts fileName as a binary file to destination with key.
return: (string) if destination == nil, the encrypted data key: (string) hex string fileName: (string) path to the clear file path: (string) File Search Path for fileName, see http://wiki.garrysmod.com/page/File_Search_Paths destination: (string) path to the destination file (relative to data folder) compress: (bool) compress data using LZMA (recommended) method: (string) encryption method
momo_encryption.DecryptFile( key, fileName, path, decompress, method )
Decrypts fileName as a binary file with key.
return: (string) decrypted data, false on failure key: (string) hex string fileName: (string) path to the encrypted file path: (string) File Search Path for fileName, see http://wiki.garrysmod.com/page/File_Search_Paths decompress: (bool) decompress data using LZMA method: (string) decryption method
momo_encryption.EncryptLuaFile( key, fileName, path, destination, compress, method )
Encrypts fileName as a Lua file to destination with key.
return: (no value) key: (string) hex string fileName: (string) path to the clear file path: (string) File Search Path for fileName, see http://wiki.garrysmod.com/page/File_Search_Paths destination: (string) path to the destination file (relative to data folder) compress: (bool) compress data using LZMA (recommended) method: (string) encryption method
momo_encryption.DecryptLua( key, encrypted, identifier, runNow, decompress, method )
Decrypts encrypted as Lua code with key.
return: (function) decrypted Lua code return: (vararg) if runNow, values returned by the Lua code key: (string) hex string encrypted: (string) encrypted Lua code identifier: (string) path to show in error messages (does not have to be unique) runNow: (string) run the Lua code now? decompress: (bool) decompress data using LZMA method: (string) decryption method
momo_encryption.DecryptLuaFile( key, fileName, identifier, runNow )
Decrypts fileName as a Lua file with key.
return: (function) decrypted Lua file return: (vararg) if runNow, values returned by the Lua file key: (string) hex string fileName: (string) full path to the encrypted Lua file (relative to lua folder) identifier: (string) path to show in error messages (does not have to be unique) runNow: (string) run the Lua file now?
momo_encryption.IncludeLuaFile( key, fileName, identifier, includeOnServer, includeOnClient )
Includes an encrypted Lua file on the server or on the client.
return: (vararg) if includeOnServer, values returned by the Lua file key: (string) hex string fileName: (string) full path to the encrypted Lua file (relative to lua folder) identifier: (string) path to show in error messages (does not have to be unique) includeOnServer: (bool) include the file serverside includeOnClient: (bool) include the file clientside
Note: Player:SendLua() is not used because of limited length & Lua code capturing danger.
free
Popular Discussions View All (1)
0
7 Jul, 2018 @ 6:54am
Ideas for RSA (or other asymmetric) encryption
Cédric GÉRILLE [GiletJaune]
15 Comments
Cédric GÉRILLE [GiletJaune]  [author] 28 Nov, 2021 @ 3:08am 
It's basically nothing more than an API. Most of implemented things do not have an out-of-the-box purpose. The protection against Lua code stealing is inefficient.
rocinha 23 Nov, 2021 @ 10:18am 
I don't understand, can i have a video how to configure it? thanks
Cédric GÉRILLE [GiletJaune]  [author] 25 Feb, 2020 @ 11:02am 
Hehe yes and I agree with the decision! :-P
This add-on is updated though. :-3
Lord of Owls 25 Feb, 2020 @ 10:53am 
yea, rubat recently decided to update to steamugc for addons aswell gmad.exe received an update for to prevent malformed header issues
Cédric GÉRILLE [GiletJaune]  [author] 25 Feb, 2020 @ 9:50am 
It's called "manual rename". I applied an illegal filename in order to have a greater priority in the loading process.
Okay now that you say it, I think that there are new checks in .gma files. :steamsad:
Lord of Owls 25 Feb, 2020 @ 6:41am 
your gma file seems to have been corrupted at some point. I'm getting the following in my console when subbed to the addon
```
Not loading addon 'Momo's Encryption Library' - Invalid filename: 'lua/autorun/momo_encryption.lua': Code point 6
Couldn't mount addon file 'addons/momos_encryption_library_939273135.gma' from 'Momo's Encryption Library' (939273135)
Removing bad addon addons/momos_encryption_library_939273135.gma
```
Cédric GÉRILLE [GiletJaune]  [author] 16 Sep, 2017 @ 6:18pm 
Non désolé.
󠀡 16 Sep, 2017 @ 6:16pm 
ducoup scripthook est patchable ?
Nogitsu 22 Jun, 2017 @ 9:14am 
Then you will have an up to date encryption system :steamhappy:
Cédric GÉRILLE [GiletJaune]  [author] 7 Jun, 2017 @ 5:27pm 
Bad idea, but the rules of Workshop allow you to download and use.
A better protection for all users is ensured if the addon is kept as a GMA addon.