Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
MD5 TO SHA1
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="OMRetros" data-source="post: 390164" data-attributes="member: 52579"><p>How can I convert password in core from MD5 to SHA1? I got a new cms that is in md5 but my user accounts are in SHA1. Help would be appreciated.</p><p></p><p>New CMS (MD5/BCRYPT):</p><p>[CODE]class User</p><p> {</p><p> public static function checkUser($password, $passwordDb, $username)</p><p> {</p><p> if (substr($passwordDb, 0, 1) == "$")</p><p> {</p><p> if (password_verify($password, $passwordDb))</p><p> {</p><p> return true;</p><p> }</p><p> return false;</p><p> }</p><p> else</p><p> {</p><p> if (md5($password) == $passwordDb)</p><p> {</p><p> $updateUserHash = DB::Query("UPDATE users SET password = '".self::hashed($password)."' WHERE username = '".filter(DB::Escape($username))."'"); </p><p> return true;</p><p> }</p><p> return false;</p><p> }</p><p> }</p><p> public static function hashed($password)</p><p> { </p><p> return password_hash($password, PASSWORD_BCRYPT);</p><p> }</p><p> public static function validName($username)</p><p> {</p><p> if(strlen($username) <= 12 && strlen($username) >= 3 && ctype_alnum($username))</p><p> {</p><p> return true;</p><p> }</p><p> return false;</p><p> }[/CODE]</p><p>OLD CMS - SHA1:</p><p>[PHP]function ValidateUser($username, $password)</p><p> {</p><p> return mysql_num_rows(dbquery("SELECT null FROM users WHERE username = '" . $username . "' AND password = '" . $password. "' LIMIT 1"));</p><p> }</p><p> </p><p> function UserHash($password, $username)</p><p> {</p><p> return sha1(md5($password) . strtolower($username));</p><p> }</p><p> </p><p> function HasNewCrypto($username)</p><p> {</p><p> if(mysql_result(mysql_query("SELECT newcrypto FROM users WHERE username = '" . $username . "'"), 0) == "0")</p><p> {</p><p> return true;</p><p> }</p><p> return false;</p><p> }</p><p> </p><p> function CryptoValidate($username, $password)</p><p> {</p><p> return mysql_num_rows(dbquery("SELECT null FROM users WHERE username = '" . $username . "' AND password = '" . $password. "' LIMIT 1"));</p><p> }</p><p> [/PHP]</p><p>My objective is to have the new CMS working with my old accounts securely. I do not want to be hacked and I heard md5 is not secure. Thank you!</p></blockquote><p></p>
[QUOTE="OMRetros, post: 390164, member: 52579"] How can I convert password in core from MD5 to SHA1? I got a new cms that is in md5 but my user accounts are in SHA1. Help would be appreciated. New CMS (MD5/BCRYPT): [CODE]class User { public static function checkUser($password, $passwordDb, $username) { if (substr($passwordDb, 0, 1) == "$") { if (password_verify($password, $passwordDb)) { return true; } return false; } else { if (md5($password) == $passwordDb) { $updateUserHash = DB::Query("UPDATE users SET password = '".self::hashed($password)."' WHERE username = '".filter(DB::Escape($username))."'"); return true; } return false; } } public static function hashed($password) { return password_hash($password, PASSWORD_BCRYPT); } public static function validName($username) { if(strlen($username) <= 12 && strlen($username) >= 3 && ctype_alnum($username)) { return true; } return false; }[/CODE] OLD CMS - SHA1: [PHP]function ValidateUser($username, $password) { return mysql_num_rows(dbquery("SELECT null FROM users WHERE username = '" . $username . "' AND password = '" . $password. "' LIMIT 1")); } function UserHash($password, $username) { return sha1(md5($password) . strtolower($username)); } function HasNewCrypto($username) { if(mysql_result(mysql_query("SELECT newcrypto FROM users WHERE username = '" . $username . "'"), 0) == "0") { return true; } return false; } function CryptoValidate($username, $password) { return mysql_num_rows(dbquery("SELECT null FROM users WHERE username = '" . $username . "' AND password = '" . $password. "' LIMIT 1")); } [/PHP] My objective is to have the new CMS working with my old accounts securely. I do not want to be hacked and I heard md5 is not secure. Thank you! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
MD5 TO SHA1
Top