Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


How to hash password correctly in PHP? filter_list
Author
Message
RE: How to hash password correctly in PHP? #11
(08-25-2017, 09:53 PM)Sikom Wrote:
(08-25-2017, 09:51 PM)Jakub Wrote: Im hashing passwords on my websites/scripts using double md5 + salt and i personally prefer this way.

md5 is not really secure though is it?

i'm working with it for 1 year now and for now it's okay. But i have my own "hash" function so if double md5 with salt fails i will switch to my hash function

Reply

RE: How to hash password correctly in PHP? #12
(08-25-2017, 10:00 PM)Jakub Wrote:
(08-25-2017, 09:53 PM)Sikom Wrote:
(08-25-2017, 09:51 PM)Jakub Wrote: Im hashing passwords on my websites/scripts using double md5 + salt and i personally prefer this way.

md5 is not really secure though is it?

i'm working with it for 1 year now and for now it's okay. But i have my own "hash" function so if double md5 with salt fails i will switch to my hash function

What do you mean by your own "hash" function? I think MD5 is considered unsecure, and I don't think you should use it.

Reply

RE: How to hash password correctly in PHP? #13
I have my own algorythm, php script which is hashing passwords, texts etc. (i.e. it will change "a" to "#72gwvs&") i'm using that hashing for my own private website where i have all of my projects. Once a month i'm changing algorythm for safety

Reply

RE: How to hash password correctly in PHP? #14
(08-25-2017, 10:19 PM)Jakub Wrote: I have my own algorythm, php script which is hashing passwords, texts etc. (i.e. it will change "a" to "#72gwvs&") i'm using that hashing for my own private website where i have all of my projects. Once a month i'm changing algorythm for safety

Do you even know anything about cryptology?

[+] 1 user Likes Sikom's post
Reply

RE: How to hash password correctly in PHP? #15
(08-25-2017, 10:00 PM)Jakub Wrote:
(08-25-2017, 09:53 PM)Sikom Wrote:
(08-25-2017, 09:51 PM)Jakub Wrote: Im hashing passwords on my websites/scripts using double md5 + salt and i personally prefer this way.

md5 is not really secure though is it?

i'm working with it for 1 year now and for now it's okay. But i have my own "hash" function so if double md5 with salt fails i will switch to my hash function

This beyond stupid.
MD5 was peer reviewed and looked over by tons of security experts, yet it was still broken.
Your own algorithm is probably not as advanced as MD5, and is a major security hole.

Use bcrypt or something ffs

PHP has a password_hash() function for a reason. Use it, the default algorithm is BCRYPT. @Sikom this goes to you aswell.
(This post was last modified: 08-26-2017, 12:00 AM by Blink.)


(11-02-2018, 02:51 AM)Skullmeat Wrote: Ok, there no real practical reason for doing this, but that's never stopped me.

[+] 2 users Like Blink's post
Reply

RE: How to hash password correctly in PHP? #16
Never try to out think crackers man, never use your own algorithm, always use opensourced crypto.
[Image: tm06mQ3.gif]
If my threads help you feel free to Like and Rep
Keybase | https://keybase.io/ecks  ProtonMail | n3r0nu77@protonmail.com  Steam | Nu77v47u3  Discord | Ecks#2162


Reply

RE: How to hash password correctly in PHP? #17
(08-25-2017, 11:54 PM)Ender Wrote: PHP has a password_hash() function for a reason.  Use it, the default algorithm is BCRYPT.

This ^^ Enough said.

It's key stretching algorithm speaks for Itself.
[Image: AD83g1A.png]

Reply

RE: How to hash password correctly in PHP? #18
(08-25-2017, 11:54 PM)Ender Wrote:
(08-25-2017, 10:00 PM)Jakub Wrote:
(08-25-2017, 09:53 PM)Sikom Wrote: md5 is not really secure though is it?

i'm working with it for 1 year now and for now it's okay. But i have my own "hash" function so if double md5 with salt fails i will switch to my hash function

This beyond stupid.
MD5 was peer reviewed and looked over by tons of security experts, yet it was still broken.
Your own algorithm is probably not as advanced as MD5, and is a major security hole.

Use bcrypt or something ffs

Would agree with that being beyond stupid


Is this a good solution @'ender'?
Code:
function hashPassword($password, $salt){
   $secretkey = 'A long key that is in code. Over 1000 chars';
   
   //Amount of iterations
   $iterations = 100;
   $hash = hash('sha512', $salt . $password . $secretkey);

   for($i = 0; i < $iterations-1; $i++) {
       $hash = hash('sha512', $salt . $hash . $secretkey);
   }
   return $hash;
}
function checkPassword($password, $hashedPassword, $salt){
   //Hashes the password for comparing to the hashedPassword in the db
   $hash = hashPassword($password, $salt);

   //Sleep to prevent a timing attack
   usleep(random_int(100,1000));
   if($hash === $hashedPassword){
       return true;
   }
   return false;
}
(This post was last modified: 08-26-2017, 11:21 AM by Sikom.)

Reply

RE: How to hash password correctly in PHP? #19
(08-26-2017, 11:15 AM)Sikom Wrote:
(08-25-2017, 11:54 PM)Ender Wrote:
(08-25-2017, 10:00 PM)Jakub Wrote: i'm working with it for 1 year now and for now it's okay. But i have my own "hash" function so if double md5 with salt fails i will switch to my hash function

This beyond stupid.
MD5 was peer reviewed and looked over by tons of security experts, yet it was still broken.
Your own algorithm is probably not as advanced as MD5, and is a major security hole.

Use bcrypt or something ffs

Would agree with that being beyond stupid


Is this a good solution @'ender'?
Code:
function hashPassword($password, $salt){
   $secretkey = 'A long key that is in code. Over 1000 chars';
   
   //Amount of iterations
   $iterations = 100;
   $hash = hash('sha512', $salt . $password . $secretkey);

   for($i = 0; i < $iterations-1; $i++) {
       $hash = hash('sha512', $salt . $hash . $secretkey);
   }
   return $hash;
}
function checkPassword($password, $hashedPassword, $salt){
   //Hashes the password for comparing to the hashedPassword in the db
   $hash = hashPassword($password, $salt);

   //Sleep to prevent a timing attack
   usleep(random_int(100,1000));
   if($hash === $hashedPassword){
       return true;
   }
   return false;
}

This is not a good solution.
Use BCRYPT man

Reply

RE: How to hash password correctly in PHP? #20
(08-26-2017, 12:48 PM)Pikami Wrote:
(08-26-2017, 11:15 AM)Sikom Wrote:
(08-25-2017, 11:54 PM)Ender Wrote: This beyond stupid.
MD5 was peer reviewed and looked over by tons of security experts, yet it was still broken.
Your own algorithm is probably not as advanced as MD5, and is a major security hole.

Use bcrypt or something ffs

Would agree with that being beyond stupid


Is this a good solution @'ender'?
Code:
function hashPassword($password, $salt){
   $secretkey = 'A long key that is in code. Over 1000 chars';
   
   //Amount of iterations
   $iterations = 100;
   $hash = hash('sha512', $salt . $password . $secretkey);

   for($i = 0; i < $iterations-1; $i++) {
       $hash = hash('sha512', $salt . $hash . $secretkey);
   }
   return $hash;
}
function checkPassword($password, $hashedPassword, $salt){
   //Hashes the password for comparing to the hashedPassword in the db
   $hash = hashPassword($password, $salt);

   //Sleep to prevent a timing attack
   usleep(random_int(100,1000));
   if($hash === $hashedPassword){
       return true;
   }
   return false;
}

This is not a good solution.
Use BCRYPT man

Why is that not a good solution?

Reply







Users browsing this thread: 1 Guest(s)