xUltimate Posted November 13, 2010 Share Posted November 13, 2010 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 Link to comment
dzek (varez) Posted November 13, 2010 Share Posted November 13, 2010 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. Link to comment
xUltimate Posted November 14, 2010 Author Share Posted November 14, 2010 When did I say "how to fix?" lol Link to comment
dzek (varez) Posted November 14, 2010 Share Posted November 14, 2010 i should wrote "answer to possible future question". Link to comment
xUltimate Posted November 14, 2010 Author Share Posted November 14, 2010 i should wrote "answer to possible future question". Not once was i gonna ask how to fix it. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now