Jump to content

Sign up page sha_hash_password, how is this formatted or done in PHP exactly?


Thick Nugs

Recommended Posts

hi everyone, long time user of mangos

i've been working on a webpage for a small lan party i'm having today, only because i don't wanna sign up 40 different people indiviually so i figured i would offer a localhost easier way through html / php

the only problem i am running into is, how exactly are the passwords formatted? i know it's encrypted with sha1 and my code is great up until here but i just can't seem to get the client past the login screen with any accounts i make through my webpage (yes they are inserted to the database perfectly fine) and i'm suspecting its because of me doing the algtrothirum wrong, here's a couple ways I tried doing it but to no available

$hashpw = SHA1('$user' . ':' . '$pass'); // tried this one cause someone said the pw / username are combined together	

$hashpw = hash(sha1, "$pass");

$hashpw = sha1($pass);

any ideas? anyone ever run into this problem cause i just can't seem to get it! i created a username / pw combo through the console and the password is a lot longer so maybe i'm not doing the right sha encryption or something. thanks!

any help is very much appericated!

Link to comment
Share on other sites

$sql = "INSERT INTO $db_table(`username`,`sha_pass_hash`) VALUES ('".$username."', SHA1(CONCAT(UPPER('".$username."'),':',UPPER('".$password."'))))";

That is how I did it with SQL a long time ago.

In PHP I guess it would be something like...

sha1(strtoupper($username.":".$password))

The end result should be sha1(USERNAME:PASSWORD) I believe. Echo whatever is inside sha1() to make sure that it's uppercase etc.

TL;DR: I think your problem is that you're not making it uppercase.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use