Password Encryption in MSSQL itself

Results 1 to 9 of 9
  1. #1
    Pee Aitch Pee Dave is offline
    MemberRank
    Mar 2011 Join Date
    The NetherlandsLocation
    722Posts

    Password Encryption in MSSQL itself

    So I'm wondering if it's possible to encrypt passwords in MSSQL itself?
    MSSQL has got the function "HASHBYTES" to encrypt a string to certain algorithm's.

    Example:
    SELECT * FROM Login WHERE UserID = 'SuperWaffle' AND Password = HASHBYTES('SHA1', 'somepassword')

    Is something like this possible when changing all the Stored Procedures which requires a password?

    If it's possible then it means you only need to do a few edits in MSSQL and your website.

    Discusszzz.


  2. #2
    Valued Member redigaffi is offline
    MemberRank
    Jun 2009 Join Date
    SpainLocation
    105Posts

    Re: Password Encryption in MSSQL itself

    Its possible.

  3. #3
    Ā  Phoenix is offline
    ModeratorRank
    Mar 2009 Join Date
    6,890Posts

    Re: Password Encryption in MSSQL itself

    Quote Originally Posted by redigaffi View Post
    Its possible.
    If you say it's possible, why not elaborate? Explain more please.

  4. #4
    Aristrum Mark is offline
    MemberRank
    Aug 2007 Join Date
    United KingdomLocation
    474Posts

    Re: Password Encryption in MSSQL itself

    As far as I know, MatchServer after receiving the login request packet, it calls spGetLoginInfo, which returns the UserID, AID and Password coloumns. MatchServer then proceeds to check them against the values contained in the login packet.

    Since the only value passed to spGetLoginInfo is the UserID and the checking is done in MatchServer itself, you'll need to modify something other than the database, as well.

    (Assuming I'm right, that is. Feel free to correct me if you know I'm not.)

  5. #5
    Pee Aitch Pee Dave is offline
    MemberRank
    Mar 2011 Join Date
    The NetherlandsLocation
    722Posts

    Re: Password Encryption in MSSQL itself

    Alright so the checks if the password is correct are not done in MSSQL itself?
    The query in spGetLoginInfo indeed says:
    "SELECT AID, UserID, Password FROM Login(nolock) WHERE UserID = @UserID"

    Which makes it impossible to add an encryption in it with MSSQL.
    That sucks.

  6. #6
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Password Encryption in MSSQL itself

    I remember having a login script (PHP) , that uses hash for the password...

    There it is :

    Code:
    <?php
    if($_SESSION['Username'] != ''){
    	redirect("index.php");
    	return false;
    }
    $username = sql($_POST['username']);
    //$password = sql($_POST['password']);
    $stay = sql($_POST['stay']);
    	$pass = md5($_POST['password']);
    	$hash = substr($pass, 0, 8);
    	
    $check = mssql_query("SELECT * FROM Login WHERE UserID = \"$username\" AND Password = \"$hash\"");
    if(mssql_num_rows($check) == 0){
    	alert("Username or password is wrong!", "index.php");	
    }else{
    	$data = mssql_fetch_array($check);
    	$_SESSION['Username'] = $data['UserID'];
    	$_SESSION['AID'] = $data['AID'];
    	
    	$select = mssql_query("SELECT * FROM Account WHERE UserID = \"$username\"");
    	$faszom = mssql_fetch_array($select);
    	$path = $faszom['ExePath'];
    	$_SESSION['ExePath'] = $path;
    	
    	redirect("index.php");	
    }
    ?>
    Last edited by Vusion; 18-08-11 at 12:04 AM.

  7. #7
    Freelance GunZ Developer Touchwise is offline
    MemberRank
    Aug 2009 Join Date
    The NetherlandsLocation
    754Posts

    Re: Password Encryption in MSSQL itself

    There were more DB's and webs with a encryption in it before it's possible but i ain't sure if you need to change other stuff also

  8. #8
    A Lost Marine gago117 is offline
    MemberRank
    Feb 2010 Join Date
    PhilippinesLocation
    420Posts

    Re: Password Encryption in MSSQL itself

    Linear used some password encryption at his server before.

  9. #9
    -- Nayr438 is offline
    MemberRank
    May 2008 Join Date
    241Posts

    Re: Password Encryption in MSSQL itself

    You would have to add the encryption to either match-server.exe or GunZ.exe.
    It can be hashed at the client and sent to match-server or it can be hashed at match-server upon receiving the packet. Personally its simpler to add it to match-server.



Advertisement