Kareth Posted August 24, 2012 Share Posted August 24, 2012 Hello everyone, few days ago I was working on a system to communicate a server with a SMF forum, letting players to login using their forum account. SMF engine saves users passwords as a sha1 string, and I started to look for a way of creating a sha1 hash of the password given by players on MTA to compare with the hash on forum database. Since lua does not have such function and MTA provides md5 function only (And there is also a hashing module by mabako if I remember well, but just working for windows), I came out with two possible solutions: using callRemote and making a sha1 hash on a php script was my first option, but I didnt liked the idea of sending the plain text password on a call. So I found over the internet a guy who made a function to generate sha1 hashes in lua. I decided to share it here hoping it will be useful for someone else. You can find it in the author's web in here: http://regex.info/blog/lua/sha1 I tested it and works absolutely perfect and solved my needs. Syntax for the function is: string sha1 (string str) An example would be: outputChatBox (sha1("Password")) which would output in chat the next string: 8be3c943b1609fffbfc51aad666d0a04adf83c9d I just hope this will be useful for someone else as it was for me. And once again, all credits goes to Jeffrey Friedl ( [email protected] , http://regex.info/blog/ ) Regards Link to comment
GTX Posted August 24, 2012 Share Posted August 24, 2012 This is very useful. I was searching for this. Thanks! Link to comment
Anderl Posted August 24, 2012 Share Posted August 24, 2012 This is not needed, you can use sha1 module which is on Wiki. Link to comment
GTX Posted August 24, 2012 Share Posted August 24, 2012 Module doesn't work on Linux, as far as I remember. Link to comment
Kareth Posted August 24, 2012 Author Share Posted August 24, 2012 Module doesn't work on Linux, as far as I remember. Indeed, as I mentioned in my first post, that module is only working for Windows. 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