-
Notifications
You must be signed in to change notification settings - Fork 0
/
r_obsfucate.php
75 lines (46 loc) · 1.26 KB
/
r_obsfucate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
* m4Labs Framework
*Simple Encryption class
*Allows the encryption of data with the use of pre-defined keys.
*
*
*
*
*/
class obsfucate{
public $id = "obsfucate.php";
private $keyz; private $sel;
public function __construct($key , $salt){
//Setting of the key and the salt
$this->keyz = $key;
$this->sel = $salt;
}
public function makePass($stringy){
$res = '';
for( $i = 0; $i < strlen($stringy); $i++){
$c = ord(substr($stringy, $i));
$c += ord(substr($this->keyz, (($i + 1) % strlen($this->keyz))));
$res .= chr($c & 0xFF);
}
$res = base64_encode($res);
return $res;
}
public function getPass($stringy){
$recovered_passwd = '';
$stringy = base64_decode($stringy);
for( $i = 0; $i < strlen($stringy); $i++){
$c = ord(substr($stringy, $i));
$c -= ord(substr($this->keyz, (($i + 1) % strlen($this->keyz))));
$recovered_passwd .= chr(abs($c) & 0xFF);
}
return $recovered_passwd;
}
public function makeKey($stringy){
$reckey = crypt($stringy,$this->sel);
$reckey = md5($reckey);
return $reckey;
}
//End Of Class
}
?>