SA-MP Forums Archive
SQLite password encryption REP+ - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite password encryption REP+ (/showthread.php?tid=650069)



SQLite password encryption REP+ - jasperschellekens - 20.02.2018

Im wondering how to hash passwords with sqlite both compatible with PHP and PAWN.

I am converting my server into sqllite and i am building a ucp as well.
The thing is, that the password is not hashed currently.
Does anybody know which kind of encryption i can use? and how?

I doubt it will be needed but if so:

PHP Login:

PHP код:
<?php
error_reporting
(E_ALL);
 class 
MyDB extends SQLite3
 
{
    function 
__construct()
    {
       
$this->open('LARPSERVER/scriptfiles/Data/database/testdatabase.db');
    }
 }
 
$db = new MyDB() or die ("Unable to open");
 
 
$sql 'SELECT * FROM USERS WHERE MAIL="'.$_POST["MAIL"].'" AND PASSWORD="'.$_POST["PASSWORD"].'"'
 
$stmt $db->query($sql);
 while(
$row $stmt->fetchArray(SQLITE3_ASSOC) )
 {
      
$email_address $row["MAIL"];   
      
$password $row["PASSWORD"];
      if(
$password==$_POST["PASSWORD"])
      {
         
         echo 
"<h1>Logged In</h1>";
         echo 
"ID = "$row['ID'] . "<br>";
         echo 
"NAME = "$row['NAME'] . "<br>";
         echo 
"USERNAME = "$row['USERNAME'] . "<br>";
         echo 
"MAIL = "$row['MAIL'] . "<br>";   
      }
 } 
 while(!
$row $stmt->fetchArray(SQLITE3_ASSOC) )
 {
 exit(
"<h1>faild</h1>");
 }
 
 
$db->close();
?>
The code above currently logs in without any encryption.


Re: SQLite password encryption REP+ - iKarim - 20.02.2018

There's many options:
All of these are available in PHP as well through this function: http://php.net/manual/en/function.password-hash.php