-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
38 lines (31 loc) · 1.34 KB
/
index.php
File metadata and controls
38 lines (31 loc) · 1.34 KB
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
<?php
$pass= 'testing'; // password
$salt = 'st'; // extra layer of protection
// encrypt the password
$md5pass = md5($pass); // broken into by hackers
$sha1pass = sha1($pass); // already broken into by hackers
$cryptpass = crypt($pass, $salt); // second layer of security $salt
// salt makes encryption a lot stronger, since they have to
// know the encryption algorith you used as well as the salt
// in order to crack your password
// hash generated by each
echo "$md5pass <br />";
echo "$sha1pass <br />";
echo "$cryptpass <br />";
// stronger layer of security when encrypting one within the other
// this way they have to work backwards and know
// which algorithms you used (in this case 3)
// way harder because even if they break into one, all they see is a hash or garbage
$sha1pass = sha1($md5pass); // sha1 gets md5 hash
$cryptpass = crypt($sha1pass); // crypt gets sha1 hash
echo "$cryptpass";
echo "<br /> ----------------- <br />";
// a total of three layers, much harder to break into but not impossible
if (crypt(sha1(md5($pass)) == $cryptpass))
{
// if statement is true if the encrypted string equals all the steps above
// simplified for you
echo "Password is well encrypted";
}
// md5 password gets encrypted with sha1, and sha1 is encrypted with crypt password
?>