Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Browsergames > DarkOrbit
You last visited: Today at 22:18

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[FIX] save passwords encrypted

Discussion on [FIX] save passwords encrypted within the DarkOrbit forum part of the Browsergames category.

Reply
 
Old   #1
 
UND3RW0RLD's Avatar
 
elite*gold: 1
Join Date: Jun 2011
Posts: 1,464
Received Thanks: 1,065
[FIX] save passwords encrypted

Hey because of jds post, I want all P-Server owner to check their signup and login pages. Passwords have to be saved encryped!!

If you save them as plain text put this in (you need to modify this to your cms)

First of all the SQL-Queries
Code:
ALTER TABLE `users` DROP COLUMN `password`;
ALTER TABLE `users` ADD `passhash` varchar(32);
ALTER TABLE `users` ADD `secret` tinyblob;
dosignup-part
PHP Code:
$wantpassword $_POST["password"];
$secret mksecret();
$wantpasshash md5($secret $wantpassword $secret); 
modify the the INSERT INTO users query,
delete password. replace it with passhash and secret to make it loke like that
Code:
INSERT INTO users (username, passhash, secret, ... VALUES (" .
		implode(",", array_map("sqlesc", array($wantusername, $wantpasshash, $secret, ...
dologin-part
PHP Code:
 // change $row with your var
$password $_POST["password"];
if (
$row["passhash"] != md5($row["secret"] . $password $row["secret"]))
    die(); 
global_included.php
PHP Code:
function mksecret($len 20)
{
    
$ret "";
    for (
$i 0$i $len$i++)
    
$ret .= chr(mt_rand(0255));
    return 
$ret;

UND3RW0RLD is offline  
Thanks
4 Users
Old 12/11/2013, 14:57   #2
 
Sήøwy's Avatar
 
elite*gold: 1
Join Date: Aug 2010
Posts: 1,330
Received Thanks: 1,724
I'm already having my own encryption for login data, but thanks for your time.
Sήøwy is offline  
Thanks
2 Users
Old 12/11/2013, 15:08   #3

 
Luffa's Avatar
 
elite*gold: 61
Join Date: Oct 2010
Posts: 1,188
Received Thanks: 2,403
Nice that you took your time to make something for the newbies to use.
But as i can see and think, is that you are comparing passwords after the sql query call, isn't that harmfull to the system?

Anyways thanks, and as snowy i'm using my own system for encryption, usin mcrypt and random salts.

Best Regards RQ
Luffa is offline  
Thanks
2 Users
Old 12/11/2013, 15:20   #4
 
UND3RW0RLD's Avatar
 
elite*gold: 1
Join Date: Jun 2011
Posts: 1,464
Received Thanks: 1,065
I think this is important for our own security. They handle with userinformations (email, password) and we need to trust the serveradmins to keep it safe.

To compare the logindata it's required to get sth from the database. xD (Yes there are possibilities to outsource the usermanagement-part to a filebased-database, but if someone want sth like that, they need to PN me and give me money.)
UND3RW0RLD is offline  
Thanks
1 User
Old 12/11/2013, 15:40   #5

 
Luffa's Avatar
 
elite*gold: 61
Join Date: Oct 2010
Posts: 1,188
Received Thanks: 2,403
Quote:
Originally Posted by ǝnd1ǝss-ɯonǝʎ View Post
To compare the logindata it's required to get sth from the database. xD (Yes there are possibilities to outsource the usermanagement-part to a filebased-database, but if someone want sth like that, they need to PN me and give me money.)
Here is something i made when i was in a company-practice about 2 years ago, but it is using a static salt(a bit old script but it should work).
It's using PDO (i love pdo<3).

Login progress:
PHP Code:
$cypher "CryptSaltKey";
 
$query $db->prepare("SELECT CAST(AES_DECRYPT(password, :cypher) AS CHAR) AS password, id, name, company, address, zip, city, email, dealer_type, discount_id, forceupdate FROM customers WHERE CAST(AES_DECRYPT(password, :cypher) AS CHAR) = :pass && email = :email");
$query->bindParam(":cypher",$cypher);
$query->bindParam(":email",$email);
$query->bindParam(":pass",$hpass);
       
       if(
$query->execute())
{



Registration Encrypt Using MCrypt
PHP Code:
<?php

class Encryption {

protected 
$key "CryptSaltKey"
    protected 
$td;

 private function 
_encrypt($plaintext) {
        
$plaintext_utf8 $plaintext;
        
$pad_len 16 - (strlen($plaintext_utf8) % 16);
        
$plaintext_utf8 str_pad($plaintext_utf8, (16 * (floor(strlen($plaintext_utf8) / 16) + 1)), chr($pad_len));
        
mt_srand();
        
$this->td mcrypt_module_open(MCRYPT_RIJNDAEL_128''MCRYPT_MODE_ECB'');
        @
mcrypt_generic_init($this->td$this->keyfalse);
        
$ciphertext mcrypt_generic($this->td$plaintext_utf8);
        
mcrypt_generic_deinit($this->td);
        return 
$ciphertext;
        }
}
?>

Best Regards RQ
Luffa is offline  
Thanks
4 Users
Reply


Similar Threads Similar Threads
[Trusted|Billig|Save] KillService By .Replay' & PerfectTyga [100%Save]
03/26/2013 - WarRock Trading - 13 Replies
Hallo Epvp PerfectTyga & Ich biete euch einen Killservice an. http://s7.directupload.net/images/130308/hb4lolcm .jpg Ablauf : Wir Stellen uns mit einem "NoSpawnWait-Hack" afk & ihr killt uns, dies rate ich euch mit einem Auto (Humwee) zu tuhen , denn pro kill bekommt ihr 7 Punkte statt den gewohnten 5 Punkten pro Kill :) Ablauf² : Ihr gebt uns ID+PW , und wir machen euch die kills :)
[HELP] Encrypted Hex
02/05/2013 - C/C++ - 5 Replies
Anyone knows how to decrypt an ecrypted hex codes? still learning hex codes though. ==,
pack dateien im client encrypted/encrypted head
10/21/2012 - Metin2 Private Server - 2 Replies
hi, ich hab ein problem, seit 2 wochen sind meine pc.eix und epk dateien in dem format encrypted und encrypted head die heißen nichtmehr .epk, .eix. diese kann ich nicht entpacken.. ich hab mir gestern modified client 4.5 von neonblue gezogen und da sind die dinger auch encrypted, encrypted head... das kann nicht, ich hab das früher immer mit epk und eix gemacht hab ich da irgendwas bei meinem computer umgestellt, oder was is anders? kann jemand helfen? danke sehr <3



All times are GMT +1. The time now is 22:18.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.