Giter Club home page Giter Club logo

samp-argon2's Introduction

SampArgon2

A argon2 plugin for samp in Rust.

Installation

  • Download suitable binary files from releases for your operating system
  • Add it your plugins folder
  • Add samp_argon2.dll (for windows) or samp_argon2.so (for linux) to server.cfg
  • Add samp_argon2.inc in includes folder

API

  • argon2_hash(playerid, const callback[], const pass[], const salt[], variant, mem_cost, time_cost, lanes, hash_length, const args[] = "", {Float, _}:...)
    • playerid - id of the player
    • callback[] - callback to execute after hashing
    • pass[] - string to hash
    • salt[] - string to salt
    • variant - set variant
    • mem_cost - set mem cost
    • time_cost - set time cost
    • lanes - set lanes
    • hash_length - set hash length
    • args[] - custom arguments

    Example

     main()
     {
     	argon2_hash(0, "OnPasswordHash", "password", "somesalt", VARIANT_ARGON2I, 4096, 3, 1, 32);
     }
    
     forward OnPasswordHash(playerid);
     public OnPasswordHash(playerid)
     {
     	//hashing completed
     }
  • argon2_get_hash(const hash[], size = sizeof(hash))
    • hash[] - string to store hashed data
    • size - max size of hash string

    Example

     main()
     {
     	argon2_hash(0, "OnPasswordHash", "password", "somesalt", VARIANT_ARGON2I, 4096, 3, 1, 32);
     }
    
     forward OnPasswordHash(playerid);
     public OnPasswordHash(playerid)
     {
     	new hash[85];
     	argon2_get_hash(hash);
     	printf("Hash: %s", hash);
     }
  • argon2_verify(playerid, const callback[], const pass[], const hash[], const args[] = "", {Float, _}:...)
    • playerid - id of the player
    • callback[] - callback to execute after hashing
    • pass[] - text to compare with hash
    • hash[] - hash to compare with text
    • args[] - custom arguments

    Example

     main()
     {
     	argon2_hash(0, "OnPasswordHash", "password", "somesalt", VARIANT_ARGON2I, 4096, 3, 1, 32);
     }
    
     forward OnPasswordHash(playerid);
     public OnPasswordHash(playerid)
     {
     	new hash[85];
     	argon2_get_hash(hash);
     	argon2_verify(playerid, "OnPasswordVerify", "password", hash);
     }
    
     forward OnPasswordVerify(playerid, bool:success);
     public OnPasswordVerify(playerid, bool:success)
     {
     	//success denotes verifying was successful or not
     	if(success)
     	{
     		//verfied
     	}
     	else
     	{
     		//hash doesn't match with text
     	}
     }

samp-argon2's People

Contributors

0kamil avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.