Upload current code with PSK generator

This commit is contained in:
zontreck 2024-05-15 13:44:54 -07:00
parent 504ef2211d
commit 72c525f364
4 changed files with 31 additions and 3 deletions

View file

@ -52,11 +52,19 @@ class Settings {
Future<String> 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<String> 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);
}
}

View file

@ -19,6 +19,8 @@ class OpenSimPageState extends State<OpenSimPage> {
TextEditingController databasePasswordController = TextEditingController();
TextEditingController databaseNameController = TextEditingController();
TextEditingController PSKController = TextEditingController();
String clientPSK = "";
String PSKHash = "";
@override
Future<void> didChangeDependencies() async {
@ -95,12 +97,18 @@ class OpenSimPageState extends State<OpenSimPage> {
"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"))

View file

@ -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();
?>

6
php/System.php Normal file
View file

@ -0,0 +1,6 @@
<?php
define("PSK", "No PSK Set");
define("ClientPSK", "No Client PSK Set");
?>