mirror of
https://github.com/Hizenberg469/BPIT-ATTENDANCE.git
synced 2026-04-20 02:02:25 +03:00
initial commit
This commit is contained in:
1
junet/html/cleaner.sh
Normal file
1
junet/html/cleaner.sh
Normal file
@@ -0,0 +1 @@
|
||||
rm *~ .*
|
||||
25
junet/html/decrypt_password.inc.php
Normal file
25
junet/html/decrypt_password.inc.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
function decrypt_password($sz_pwd,$password){
|
||||
$en_pwd = substr($password,0,$sz_pwd);
|
||||
$key = substr($password,$sz_pwd);
|
||||
|
||||
$key_arr = array();
|
||||
for( $i = 0 ; $i < $sz_pwd ; $i++ ){
|
||||
$key_arr[$i] = ord($key[$i]) - 33;
|
||||
}
|
||||
|
||||
$dcpt_pwd = new SplFixedArray($sz_pwd);
|
||||
|
||||
for( $i = 0 ; $i < $sz_pwd ; $i++ ){
|
||||
$dcpt_pwd[$key_arr[$i]] = $en_pwd[$i];
|
||||
}
|
||||
|
||||
$decrypt_password = '';
|
||||
|
||||
for( $i = 0 ; $i < $sz_pwd ; $i++ ){
|
||||
$decrypt_password .= $dcpt_pwd[$i];
|
||||
}
|
||||
|
||||
return $decrypt_password;
|
||||
}
|
||||
?>
|
||||
23
junet/html/encrypt_password.inc.php
Normal file
23
junet/html/encrypt_password.inc.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
function encrypt_password($password){
|
||||
$encrypt_psswd = '';
|
||||
$encrypt_idcs = '';
|
||||
$sz = strlen($password);
|
||||
$idx;
|
||||
|
||||
$set = new \Ds\Set();
|
||||
for( $i = 0 ; $i < $sz ; $i++ ){
|
||||
$idx = rand(0,$sz-1);
|
||||
while( $set->contains($idx) ){
|
||||
$idx = rand(0,$sz-1);
|
||||
}
|
||||
$encrypt_psswd .= $password[$idx];
|
||||
$set->add($idx);
|
||||
$encrypt_idcs .= chr($idx+33);
|
||||
}
|
||||
|
||||
$encrypt_psswd .= $encrypt_idcs;
|
||||
|
||||
return $encrypt_psswd;
|
||||
}
|
||||
?>
|
||||
7
junet/html/hash_gen.inc.php
Normal file
7
junet/html/hash_gen.inc.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
function gen_hash($password){
|
||||
$h_value = hash('xxh128',$password);
|
||||
|
||||
return $h_value;
|
||||
}
|
||||
?>
|
||||
14
junet/html/index.php
Normal file
14
junet/html/index.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
include 'encrypt_password.inc.php';
|
||||
include 'hash_gen.inc.php';
|
||||
include 'decrypt_password.inc.php';
|
||||
|
||||
$password = $_REQUEST['password'];
|
||||
$en_pwd = encrypt_password($password);
|
||||
|
||||
echo "Given Passowrd: ".$password."<br>";
|
||||
echo "Encrypted Password for database: ".$en_pwd." <br>";
|
||||
echo "Hash value of given password: ".gen_hash($password)."<br>";
|
||||
echo "Decrypted Password from the database: ".decrypt_password(strlen($password),$en_pwd);
|
||||
?>
|
||||
10
junet/html/psswd_test.html
Normal file
10
junet/html/psswd_test.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<form action="index.php" method="post">
|
||||
<div>
|
||||
<label for="password">
|
||||
Password : <input type="text" name="password" id="password"/>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="GO"/>
|
||||
</div>
|
||||
</form>
|
||||
Reference in New Issue
Block a user