AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   String Encryptor API (https://forums.alliedmods.net/showthread.php?t=345426)

Jhob94 01-12-2024 05:39

String Encryptor API
 
2 Attachment(s)
String Encryptor API
- v0.0.1, published at : 12/01/2024


Description
A simple tool to encrypt your string data. This allows you to encrypt by using Caeser Cipher, X0R and Fibonacci.


How to use it
PHP Code:

enum {
    
Caeser_Cipher,
    
X0R,
    
Fibonacci
}

/**
 * Encrypt a String
 *
 * @param iMethod    Caeser_Cipher / X0R / Fibonacci
 * @param szInput    Original String
 * @param szOutput    Output (Encrypted)
 * @param iMaxLen    Output Max Lenght
 * @param iKey        Used for X0R & Caeser Cipher Methods
 */
native str_encrypt(iMethod, const szInput[], szOutput[], iMaxLeniKey 0)

/**
 * Decrypt a String
 *
 * @param iMethod    Caeser_Cipher / X0R / Fibonacci
 * @param szInput    Encrypted String
 * @param szOutput    Output (Decrypted String)
 * @param iMaxLen    Output Max Lenght
 * @param iKey        Used for X0R & Caeser Cipher Methods
 */
native str_decrypt(iMethod, const szInput[], szOutput[], iMaxLeniKey 0

The important note here is the iKey.
  • Fibonacci does not require a key.
  • On Caeser Cipher you must use a key. I would recommend a value between 2 and 10.
  • On X0R method you should also use a key, you can find bellow some key examples.


X0R Example Keys
  • 0x42
  • 0x7F
  • 0xAA
  • 0xF0
  • 0x88
  • 0xC5
  • 0x3E
  • 0xD7

Jhob94 01-12-2024 05:46

Re: String Encryptor API
 
1 Attachment(s)
For futher understanding on how to use this API you can check this plugin that i've made for a quick test.

Keep in mind that this plugin is just made for testing as encrypted results that include quotes will terminate the console command while trying to decrypt.


This is the output of test plugin:
HTML Code:

encrypt_cipher "Encryptor API"
Irgv}txsv$ETM

] decrypt_cipher "Irgv}txsv$ETM!"
Encryptor API

] encrypt_fib "Version 0.0.1"
Wguxq|Bg@*

] decrypt_fib "Wguxq|Bg@*"
Version 0.0.1

] encrypt_x0r "Made by Jhob94"
;>?z8#z258cn

] decrypt_x0r ";>?z8#z258cn"
Made by Jhob94


bigdaddy424 01-13-2024 08:09

Re: String Encryptor API
 
this is not an api more of a library and you should probably post this on code snippets

Jhob94 01-13-2024 09:34

Re: String Encryptor API
 
Quote:

Originally Posted by bigdaddy424 (Post 2815980)
this is not an api more of a library and you should probably post this on code snippets

This is an interface, not a stock. I could had built it like a stock yes, but I didn’t. Probably i will add more features to this plugin some day.

So.. If it is an interface, not a stock, not a tutorial and not a module, this is the right place.

bigdaddy424 01-13-2024 09:58

Re: String Encryptor API
 
its not an interface and neither a library. its just a function that `encrypts` text least safest way. if someone finds it reasonable to encrypt text inside a game id assume theyd go for something more secure, hash_* functions already have some pretty solid encrypt models to choose from.

fysiks 01-13-2024 16:55

Re: String Encryptor API
 
I would argue that a "plugin submission" is for end-user plugins, not tools for developers (which may become dependencies of actual end-user plugins.

Jhob94 01-13-2024 22:04

Re: String Encryptor API
 
Quote:

Originally Posted by fysiks (Post 2816003)
I would argue that a "plugin submission" is for end-user plugins, not tools for developers (which may become dependencies of actual end-user plugins.

If that’s case, which as far as i know is not specified anywhere, where should i post this or my virtual weapons slots api?

Bugsy 01-14-2024 15:05

Re: String Encryptor API
 
Code Snippets/Tuts is more fitting IMO


All times are GMT -4. The time now is 23:01.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.