Authenticate

SClark

New member
When passwords, salt, and all that non sense are stored into xf_user_authenticate are they sent as a string or something else. From what I've gather it's binary but a closer look when I use SELECT it's in a table format serialized. I guess my question how do you serialize it.

If you remotely understand lua take a look at this.
Code:
salt = self:Salt(64)
pass = string.lower(tostring(pass))
pass = string.lower(crypto.sha256(pass))
pass = string.lower(crypto.sha256(pass .. salt))
hash = 'a:3:{s:4:\"hash\";s:64:\"' .. pass .. '\";s:4:\"salt\";s:64:\"' .. salt .. '\";s:8:\"hashFunc\";s:6:\"sha256\";}'
local query2 = database:query("INSERT INTO " .. Prefix .. "_user (`username`, `email`, `user_group_id`, `register_date`, `user_state`) VALUES ('" .. escape(user) .. "', '" .. escape(email) .. "', '" .. group .. "', '" .. regdate .. "', '" .. escape('valid') .. "')")

This is a project I'm heading up for garry's mod communities. My code is available here.
 
It is just serialize()'ed from PHP. I'm sure there would be an alternative for Lua or that it would be using some standard.

Edit: you should actually be using XenForo to handle all this. Or at least PHP.
 
Lua does have a serialize'r in a sense. At least for garry's mod. It called glon. What I'm really after is, is it inserted as a string? It says in binary in phpmyadmin.
 
Thanks for the help. Looks easy once I went in depth a bit more than before. Actually got a grasp on what it should look like.
 
Top Bottom