• 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Plugin] SampBcrypt
#1
SampBcrypt

[Image: samp-bcrypt.svg?branch=master] [Image: 5rq55kukvy8xymly?svg=true] [Image: sampctl-SampBcrypt-2f2f2f.svg] [Image: samp-bcrypt.svg] [Image: samp-bcrypt.svg] [Image: samp-bcrypt.svg]

A bcrypt plugin for samp in Rust.

Installation

sampctl

If you are a sampctl user

sampctl p install Sreyas-Sreelal/samp-bcrypt

OR
  • Download suitable binary files from releases for your operating system
  • Add it your plugins folder
  • Add samp_bcrypt to server.cfg or? samp_bcrypt.so (for linux)
  • Add samp_bcrypt.inc in includes folder
Building
API
  • bcrypt_hash(playerid,callback[],input[],cost)
    • playerid - id of the player
    • callback[] - callback to execute after hashing
    • input[] - string to hash
    • cost - work factor (4 - 31)
  • Example

    PHP Code:
    main(){
     
    bcrypt_hash(0,"OnPassswordHash","text",12);
    }


    forward OnPassswordHash(playerid);
    public 
    OnPassswordHash(playerid){
     
    //hashing completed


  • bcrypt_get_hash(dest[],size = sizeof(hash))
    • dest[] - string to store hashed data
    • size - max size of dest string
  • Example

    PHP Code:
    main(){
     
    bcrypt_hash(0,"OnPassswordHash","text",12);
    }


    forward OnPassswordHash(playerid);
    public 
    OnPassswordHash(playerid){
     new 
    dest[250];
     
    bcrypt_get_hash(dest);
     
    printf("hash : %s",dest);


  • bcrypt_verify(playerid,callback[],input[],hash[])
    • playerid - id of the player
    • callback[] - callback to execute after hashing
    • input[] - text to compare with hash
    • hash[] - hash to compare with text
  • Example

    PHP Code:
    main(){
     
    bcrypt_hash(0,"OnPassswordHash","text",12);
    }


    forward OnPassswordHash(playerid);
    public 
    OnPassswordHash(playerid){
     new 
    dest[250];
     
    bcrypt_get_hash(dest);
     
    bcrypt_verify(playerid,"OnPassswordVerify","text",dest);
    }


    forward OnPassswordVerify(playerid,bool:success);
    public 
    OnPassswordVerify(playerid,bool:success){
     
    //success denotes verifying was successful or not
     
    if(success){
     
    //verfied
     
    } else{
     
    //hash doesn't match with text
     
    }


  • bcrypt_set_thread_limit(value)
    • value - number of worker threads at a time
  • Example

    PHP Code:
    main(){
     
    bcrypt_set_thread_limit(3);

  Reply


Messages In This Thread
SampBcrypt - by SyS - 2019-04-14, 07:41 AM
RE: SampBcrypt - by Mugsy - 2019-04-14, 07:48 AM
RE: SampBcrypt - by Shady - 2019-04-14, 02:08 PM
RE: SampBcrypt - by kristo - 2019-04-14, 02:08 PM
RE: SampBcrypt - by Justus - 2019-04-14, 09:58 PM
RE: SampBcrypt - by SyS - 2019-04-28, 05:00 AM
RE: SampBcrypt - by hual - 2019-05-01, 02:09 PM
RE: SampBcrypt - by Sasino97 - 2019-06-11, 06:56 AM
RE: SampBcrypt - by SynTacs - 2019-06-17, 01:58 AM
RE: SampBcrypt - by PatrickGTR - 2019-06-17, 02:55 PM
RE: SampBcrypt - by SynTacs - 2019-06-18, 01:59 AM
RE: SampBcrypt - by SyS - 2020-05-01, 03:53 AM
RE: SampBcrypt - by Y_Less - 2020-06-04, 10:19 PM
RE: SampBcrypt - by SyS - 2020-07-10, 02:02 PM
RE: SampBcrypt - by SyS - 2023-03-17, 03:17 AM

Forum Jump: