SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 14/07/2015, 12:06 AM   #11
yugecin
Big Clucker
 
Join Date: Oct 2009
Location: Belgium
Posts: 83
Reputation: 82
Default Re: Using new SHA-256 function

Nice tutorial

Quote:
Originally Posted by dominik523 View Post
random(79) + 47; - we are getting a random value from the ASCII table from 33 to 126
Wouldn't the result be 47 - 125?
__________________
robin_be
yugecin is offline   Reply With Quote
Old 14/07/2015, 01:10 AM   #12
scaunel
Little Clucker
 
scaunel's Avatar
 
Join Date: Feb 2014
Location: Turnu Măgurele, România
Posts: 31
Reputation: 8
Default Re: Using new SHA-256 function

a bit like Whirlpool complicated but is very good and also useful
scaunel is offline   Reply With Quote
Old 14/07/2015, 08:36 AM   #13
dominik523
Gangsta
 
dominik523's Avatar
 
Join Date: Feb 2013
Location: Croatia
Posts: 893
Reputation: 115
Default Re: Using new SHA-256 function

Quote:
Originally Posted by yugecin View Post
Nice tutorial



Wouldn't the result be 47 - 125?
Random(79) will give anything from 0 to 79, and we don't want our characters to start from 0 which is null in ASCII. Because of that, we are adding 47 to it so we'll get anything from / to ~.

Thank you all for your kind replies.
EDIT: @Youssef221 - You can do the same thing. Just like saving password in INI, save the salt and load it when the user joins the server. If you really want it, I could add a small part to the tutorial which will be in y_ini.
__________________
[Tutorial] Using new SHA-256 function
dominik523 is offline   Reply With Quote
Old 14/07/2015, 10:59 AM   #14
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 4,844
Reputation: 2179
Default Re: Using new SHA-256 function

Quote:
Originally Posted by dominik523 View Post
Random(79) will give anything from 0 to 79, and we don't want our characters to start from 0 which is null in ASCII. Because of that, we are adding 47 to it so we'll get anything from / to ~.
It will give a value from [0,max), meaning that the highest value you will ever get is max-1, or in the case of random(79) it's 78.

Otherwise it's a decent tutorial, anyone dealing with passwords should be aware of hashing.
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline   Reply With Quote
Old 14/07/2015, 11:58 AM   #15
dominik523
Gangsta
 
dominik523's Avatar
 
Join Date: Feb 2013
Location: Croatia
Posts: 893
Reputation: 115
Default Re: Using new SHA-256 function

Quote:
Originally Posted by Hiddos View Post
It will give a value from [0,max), meaning that the highest value you will ever get is max-1, or in the case of random(79) it's 78.

Otherwise it's a decent tutorial, anyone dealing with passwords should be aware of hashing.
Yeah, that's what I meant but I have no idea why did I write 79. Oh well.
I totally agree. Hashing isn't that hard and it should be always done. Thanks!
__________________
[Tutorial] Using new SHA-256 function
dominik523 is offline   Reply With Quote
Old 14/07/2015, 01:28 PM   #16
Youssef221
Big Clucker
 
Join Date: Jul 2013
Posts: 194
Reputation: 11
Default Re: Using new SHA-256 function

Nevermind, it was a mistake in some code.

Last edited by Youssef221; 14/07/2015 at 02:51 PM.
Youssef221 is offline   Reply With Quote
Old 14/07/2015, 04:41 PM   #17
Youssef221
Big Clucker
 
Join Date: Jul 2013
Posts: 194
Reputation: 11
Default Re: Using new SHA-256 function

there is a problem, I can't log in my account, it always say invalid pass

EDIT: codes: http://pastebin.com/teJcJnHB
Youssef221 is offline   Reply With Quote
Old 14/07/2015, 05:08 PM   #18
dominik523
Gangsta
 
dominik523's Avatar
 
Join Date: Feb 2013
Location: Croatia
Posts: 893
Reputation: 115
Default Re: Using new SHA-256 function

Can you please check if you are saving correct salt and password (print it out when user registers) and then check if you are loading the correct values.
EDIT: There is now 0.3.7 R2-1 version of SA:MP which fixes SHA256 function. Be sure to update your server files.
__________________
[Tutorial] Using new SHA-256 function
dominik523 is offline   Reply With Quote
Old 14/07/2015, 11:05 PM   #19
Cyber123
Big Clucker
 
Join Date: Apr 2014
Posts: 79
Reputation: 1
Default Re: Using new SHA-256 function

This is good way to hash passwords .. thanks for tutorial broo
Cyber123 is offline   Reply With Quote
Old 16/07/2015, 03:12 AM   #20
RaeF
Huge Clucker
 
Join Date: Dec 2014
Location: Indonesia
Posts: 265
Reputation: 27
Default Re: Using new SHA-256 function

Why do we must hash a password ? there is any chance someone trying to hack player account??

Edit:

Is it possible to attack password inside .ini .json files?
__________________
Release:

- Nothing - I dont have idea to release something.
RaeF is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 055: start of function body without function header Magnezia Scripting Help 3 19/05/2015 05:11 AM
[Ajuda] error 055: start of function body without function header AndersonAq Português/Portuguese 3 14/03/2014 12:31 AM
Returning inside a switch case, does it go back to the scope of the function, or does it return for the function? Hoborific Scripting Help 4 26/06/2013 12:47 PM


All times are GMT. The time now is 04:32 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.