extended-encryption-exists-function
Gesponsorde koppelingen
PHP script bestanden
Code (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
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
<?php
//
// extended isset
//
function exists($input)
{
if(isset($input) && input != '')
{
return true;
}
}
//
// extended encryption
//
function encrypt($input)
{
if(isset($input) && $input != '')
{
$input_length = strlen($input);
switch($input_length)
{
case 1:
case 2:
case 3:
$salt_start = substr($input, 0, 1);
$salt_end = substr($input, -1);
break;
case 4:
case 5:
$salt_start = substr($input, 0, 3);
$salt_end = substr($input, -2);
break;
default:
$salt_start = substr($input, 0, 5);
$salt_end = substr($input, -3);
break;
}
$encrypted = sha1(md5($salt_start).md5($input).md5($salt_end));
if($encrypted != md5($input))
{
return $encrypted;
}
else
{
trigger_error('There was no salt created. Check your input lenght.', E_USER_ERROR);
}
}
else
{
trigger_error('Function encrypt has no input.', E_USER_ERROR);
}
}
?>
//
// extended isset
//
function exists($input)
{
if(isset($input) && input != '')
{
return true;
}
}
//
// extended encryption
//
function encrypt($input)
{
if(isset($input) && $input != '')
{
$input_length = strlen($input);
switch($input_length)
{
case 1:
case 2:
case 3:
$salt_start = substr($input, 0, 1);
$salt_end = substr($input, -1);
break;
case 4:
case 5:
$salt_start = substr($input, 0, 3);
$salt_end = substr($input, -2);
break;
default:
$salt_start = substr($input, 0, 5);
$salt_end = substr($input, -3);
break;
}
$encrypted = sha1(md5($salt_start).md5($input).md5($salt_end));
if($encrypted != md5($input))
{
return $encrypted;
}
else
{
trigger_error('There was no salt created. Check your input lenght.', E_USER_ERROR);
}
}
else
{
trigger_error('Function encrypt has no input.', E_USER_ERROR);
}
}
?>