Jump to content

So what's the salt?


xUltimate

Recommended Posts

Posted

Ok, so in my server I have this thing called "salt" and a player cant login without it in there name on the sql, I made a UCP where they can register but I can't figure out the salt.

Here's the "salt"

-- generate a salt (SHA1) 
                            local salt = '' 
                            local chars = { 'a', 'b', 'c', 'd', 'e', 'f', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } 
                            for i = 1, 40 do 
                                salt = salt .. chars[ math.random( 1, #chars ) ] 
                            end 
                             
                            -- create the user 
                            if exports.sql:query_free( "INSERT INTO wcf1_user (username,salt,password) VALUES ('%s', '%s', SHA1(CONCAT('%s', SHA1(CONCAT('%s', '" .. sha1( password ) .. "')))))", username, salt, salt, salt ) then 
                                triggerClientEvent( source, getResourceName( resource ) .. ":registrationResult", source, 0 ) -- will automatically login when this is sent 
                            else 

Posted

Read again what salt is and what it is used for. Also read about hashing. http://wikipedia.org/

Actually:

1. You don't know what salting is for.

2. You don't see difference between hashing and salting. These are DIFFERENT actions! Okay, they are mostly used together, but this doesn't mean they're same thing.\

Edit:

And answer to question "how to fix?" - this is totally wrong. Nothing to fix here. Whole code to rewrite.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

i should wrote "answer to possible future question".

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...