Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Whirlpool hash, jak to skonfigurować?
Benoc
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 19.05.2018

Ostrzeżenie: (0%)
-----


Cześć,
Mam pytanie odnośnie konfiguracji Whirlpool na forum, nigdzie nic nie mogę o tym znaleźć, a chcę zastąpić md5 whirlpoolem bo jest po prostu lepszy (IMG:style_emoticons/default/smile.gif)

Dodaje kod md5:
  1. function salt_password($password, $salt)
  2. {
  3. return md5(md5($salt).$password);
  4. }


  1. function create_password($password, $salt = false, $user = false)
  2. {
  3. global $plugins;
  4.  
  5. $fields = null;
  6.  
  7. $parameters = compact('password', 'salt', 'user', 'fields');
  8.  
  9. if(!defined('IN_INSTALL') && !defined('IN_UPGRADE'))
  10. {
  11. $plugins->run_hooks('create_password', $parameters);
  12. }
  13.  
  14. if(!is_null($parameters['fields']))
  15. {
  16. $fields = $parameters['fields'];
  17. }
  18. else
  19. {
  20. if(!$salt)
  21. {
  22. $salt = generate_salt();
  23. }
  24.  
  25. $hash = md5(md5($salt).md5($password));
  26.  
  27. $fields = array(
  28. 'salt' => $salt,
  29. 'password' => $hash,
  30. );
  31. }
  32.  
  33. return $fields;
  34. }



  1. function verify_user_password($user, $password)
  2. {
  3. global $plugins;
  4.  
  5. $result = null;
  6.  
  7. $parameters = compact('user', 'password', 'result');
  8.  
  9. if(!defined('IN_INSTALL') && !defined('IN_UPGRADE'))
  10. {
  11. $plugins->run_hooks('verify_user_password', $parameters);
  12. }
  13.  
  14. if(!is_null($parameters['result']))
  15. {
  16. return $parameters['result'];
  17. }
  18. else
  19. {
  20. $password_fields = create_password($password, $user['salt'], $user);
  21.  
  22. return my_hash_equals($user['password'], $password_fields['password']);
  23. }
  24. }


Jakby ktoś potrzebował cały kod: https://pastebin.com/gFjwVk8t

Z góry dziękuje za pomoc (IMG:style_emoticons/default/smile.gif)
Pozdrawiam

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
viking
post
Post #2





Grupa: Zarejestrowani
Postów: 6 381
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Poczytaj lepiej o password_hash.
Go to the top of the page
+Quote Post
Benoc
post
Post #3





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 19.05.2018

Ostrzeżenie: (0%)
-----


Cytat(viking @ 19.05.2018, 14:13:00 ) *
Poczytaj lepiej o password_hash.


Zamieniłem na to:
  1. function salt_password($password, $salt)
  2. {
  3. return hash('whirlpool', $salt . $checkPass);
  4. }


oraz na to:

  1. function create_password($password, $salt = false, $user = false)
  2. {
  3. global $plugins;
  4.  
  5. $fields = null;
  6.  
  7. $parameters = compact('password', 'salt', 'user', 'fields');
  8.  
  9. if(!defined('IN_INSTALL') && !defined('IN_UPGRADE'))
  10. {
  11. $plugins->run_hooks('create_password', $parameters);
  12. }
  13.  
  14. if(!is_null($parameters['fields']))
  15. {
  16. $fields = $parameters['fields'];
  17. }
  18. else
  19. {
  20. if(!$salt)
  21. {
  22. $salt = generate_salt();
  23. }
  24.  
  25. $hash = hash('whirlpool', $salt . $checkPass);
  26.  
  27. $fields = array(
  28. 'salt' => $salt,
  29. 'password' => $hash,
  30. );
  31. }
  32.  
  33. return $fields;
  34. }



Ale dalej coś nie działa (IMG:style_emoticons/default/tongue.gif)

Prosiłbym o dalszą pomoc.
Go to the top of the page
+Quote Post

Posty w temacie
- Benoc   Whirlpool hash, jak to skonfigurować?   19.05.2018, 12:40:04
- - viking   Poczytaj lepiej o password_hash.   19.05.2018, 13:13:00
- - Benoc   Cytat(viking @ 19.05.2018, 14:13:00 )...   26.05.2018, 13:44:24


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 21:02