diff --git a/lib/Settings.dart b/lib/Settings.dart index 6831040..e45c32e 100644 --- a/lib/Settings.dart +++ b/lib/Settings.dart @@ -52,11 +52,19 @@ class Settings { Future hashPSK(String PSK) async { String hash = Hashing.md5Hash("AriasCreations"); - for (int i = 0; i < 512; i++) { + for (int i = 0; i < 8192; i++) { hash = Hashing.sha256Hash("${hash}:${PSK}"); } - hash = Hashing.md5Hash(hash); + hash = Hashing.sha256Hash(hash); return hash; } + + Future createClientPSK(String hashedPSK) async { + String hash = Hashing.sha256Hash("AriasCreations"); + for (int i = 0; i < 8192; i++) { + hash = Hashing.sha256Hash("${hash}:${hashedPSK}"); + } + return Hashing.sha256Hash(hash); + } } diff --git a/lib/pages/OpenSim.dart b/lib/pages/OpenSim.dart index 48c9a10..284fed6 100644 --- a/lib/pages/OpenSim.dart +++ b/lib/pages/OpenSim.dart @@ -19,6 +19,8 @@ class OpenSimPageState extends State { TextEditingController databasePasswordController = TextEditingController(); TextEditingController databaseNameController = TextEditingController(); TextEditingController PSKController = TextEditingController(); + String clientPSK = ""; + String PSKHash = ""; @override Future didChangeDependencies() async { @@ -95,12 +97,18 @@ class OpenSimPageState extends State { "Pre-Shared Key. Long text that gets hashed"), ), ), + ListTile( + title: Text("PSK: ${PSKHash}"), + subtitle: Text("Client: ${clientPSK}"), + ), ElevatedButton( onPressed: () async { var PSK = await settings.hashPSK(PSKController.text); + clientPSK = await settings.createClientPSK(PSK); + setState(() { - PSKController.text = PSK; + PSKHash = PSK; }); }, child: Text("Submit")) diff --git a/php/Common.php b/php/Common.php index e5c647c..8c6abc4 100644 --- a/php/Common.php +++ b/php/Common.php @@ -31,5 +31,11 @@ if(file_exists("../database.user.php")) else require("Database.php"); +if(file_exists("../system.user.php")) + require("../system.user.php"); +else + require("System.php"); + + session_start(); ?> \ No newline at end of file diff --git a/php/System.php b/php/System.php new file mode 100644 index 0000000..07c8dea --- /dev/null +++ b/php/System.php @@ -0,0 +1,6 @@ + \ No newline at end of file