SA-MP Forums Archive
MD5 or SHA1 encrypter - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MD5 or SHA1 encrypter (/showthread.php?tid=196439)



MD5 or SHA1 encrypter - hanzen - 05.12.2010

Hello,

I'm working on making my own gamemode running on MySQL, I want a password encrypter that I can match with PHP. I.E: MD5 or SHA1 the letters needs to be lowercased. Have searched but couldn't find a suitable plugin.

Answers would be appreciated
Regards' hanzen


Re: MD5 or SHA1 encrypter - JaTochNietDan - 05.12.2010

You know the SQL scripting language has a built in MD5 encrypter? For example:

pawn Код:
format(query,sizeof(query),"SELECT Information FROM `users` WHERE Password = md5(%s)",params);
Is that what you were looking for?

Additionally there is an MD5 function specifically for Pawn made by ******, if that's something you're also looking for?


Re: MD5 or SHA1 encrypter - hanzen - 05.12.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
You know the SQL scripting language has a built in MD5 encrypter? For example:

pawn Код:
format(query,sizeof(query),"SELECT Information FROM `users` WHERE Password = md5(%s)",params);
Is that what you were looking for?

Additionally there is an MD5 function specifically for Pawn made by ******, if that's something you're also looking for?
Jizzz. I'm actually aware of that, just didn't think of it, haha. Thanks

Edit:
Shit didn't work.


Re: MD5 or SHA1 encrypter - dice7 - 05.12.2010

If it didn't work then you wrote your query wrong


Re: MD5 or SHA1 encrypter - JaTochNietDan - 05.12.2010

Quote:
Originally Posted by hanzen
Посмотреть сообщение
Jizzz. I'm actually aware of that, just didn't think of it, haha. Thanks

Edit:
Shit didn't work.
What didn't work about it? What's wrong? Give some information


Re: MD5 or SHA1 encrypter - hanzen - 05.12.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
What didn't work about it? What's wrong? Give some information
Well, now it returns that the password is wrong.
Код:
format(query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%s' AND `password` = 'md5(%s)';", escname, inputtext);
When I try to enter this as a query:
Код:
format(query, sizeof(query), "UPDATE players SET password = 'md5(%s)' WHERE name = '%s'", inputtext, escname);
It only saves md5(inputtext).


Re: MD5 or SHA1 encrypter - Sergei - 05.12.2010

'md5(%s)' -> mdt('%s')
Isn't this logical enough?


Re: MD5 or SHA1 encrypter - JaTochNietDan - 05.12.2010

You've written it wrong, md5 is a function, but you're writing it as a string, so that's what you're actually writing into the table!

pawn Код:
format(query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%s' AND `password` = md5('%s');", escname, inputtext);
And the same for your other one!


Re: MD5 or SHA1 encrypter - hanzen - 05.12.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
You've written it wrong, md5 is a function, but you're writing it as a string, so that's what you're actually writing into the table!

pawn Код:
format(query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%s' AND `password` = md5('%s');", escname, inputtext);
And the same for your other one!
Grr. Top of stupidness. Hahahaha, thanks for the help


Re: MD5 or SHA1 encrypter - -John- - 05.12.2010

Your query is wrong the ' character should be around the %s and not around md5() so it should look like this md5('%s')!

btw i think mysql has sha1() encryption support too so it's better to use that instead!


EDIT: late buu