Project

General

Profile

1
<?php
2
/**
3
 * @category     Core
4
 * @package      Core_security
5
 * @author       Werner v.d.Decken
6
 * @copyright    ISTeasy-project(http://isteasy.de/)
7
 * @license      Creative Commons BY-SA 3.0 http://creativecommons.org/licenses/by-sa/3.0/
8
 * @version      $Id$
9
 * @filesource   $HeadURL:$
10
 * @since        Datei vorhanden seit Release 2.8.2
11
 * @lastmodified $Date:$
12
 *
13
 * this class works with salted md5-hashes with several rounds. 
14
 * For backward compatibility it can compare normal md5-hashes also.
15
 *
16
 */
17
 $path2class = './framework/PasswordHash.php';
18
	$newpass = '';
19
	$pass    = '';
20
	$hash    = '';
21

    
22
	include $path2class;
23
	if(!isset($_POST['action']) ) { $_POST['action'] = 'pass'; }
24
	if($_POST['action'] == 'hash') {
25
		if(isset($_POST['pass']) && trim($_POST['pass']) != '') {
26
			$pass = trim($_POST['pass']);
27
			$newpass = $pass;
28
			$ph = new PasswordHash(12);
29
			$hash = $ph->HashPassword($pass);
30
		}
31
	}else {
32
		if(!isset($_POST['length']) ) { $_POST['length'] = 8; }
33
		$length = intval($_POST['length']);
34
		$newpass = PasswordHash::NewPassword($length);
35
		$pass = $newpass;
36
	}
37

    
38
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
39
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
40
	<head>
41
		<title>PWH-Generator v.0.1</title>
42
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
43
		<meta name="author" content="Werner von der Decken" />
44
		<meta name="copyright" content="ISTeasy, W.v.d.Decken" />
45
		<meta name="generator" content="ISTeasy - PWH-Generator v.0.1" />
46
		<style type="text/css">
47
			html { /* Schrifteinstellung für das ganze Dokument */
48
				font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif;
49
				font-size: 78%;
50
				font-weight: normal;
51
				color: #303030;
52
				min-height: 100.2%;
53
			}
54
			body {
55
				text-align: center;
56
				padding-top: 4em;
57
			}
58
			.body {
59
				width: 40em;
60
				margin: auto;
61
			}
62
			fieldset {
63
				padding: 1em 0;
64
			}
65
			legend {
66
				font-size: 1.3em;
67
			}
68
			input {
69
				width: 90%;
70
				margin: 0.5em 0;
71
				padding: 3px;
72
				font-size: 1.2em;
73
			}
74
			#hash { font-size: 1em; }
75
		</style>
76
		<script type="text/javascript">
77
			function clearHash() {
78
				document.genhash.hash.value = "";
79
			}
80

    
81
		</script>
82
	</head>
83
	<body>
84
		<div class="body">
85
			<h1>PWH-Generator v.0.1</h1>
86
			<fieldset>
87
				<legend>&nbsp;Password-Generator&nbsp;</legend>
88
				<form  method="post" name="genpass" action="">
89
					<input type="hidden" name="action" value="pass" />
90
					<label for="length">length of password </label>&nbsp;&nbsp;
91
					<input type="radio" name="length" value="6">06</input>&nbsp;
92
					<input type="radio" name="length" value="8" checked="checked">08</input>&nbsp;
93
					<input type="radio" name="length" value="10">10</input>&nbsp;
94
					<input type="radio" name="length" value="12">12</input>&nbsp;
95
					<input type="radio" name="length" value="14">14</input>&nbsp;
96
					<input type="radio" name="length" value="16">16</input>&nbsp;
97
					<input type="radio" name="length" value="18">18</input>&nbsp;
98
					<input type="radio" name="length" value="20">20</input>&nbsp;<br /><br />
99
					<label for="pass">Our password suggestion</label><br />
100
					<input type="text" id="pass" name="pass" value="<?php echo $newpass; ?>" readonly="readonly" /><br /><br />
101
					<input name="submit" id="submit1" type="submit" value="suggest password" />
102
				</form>
103
			</fieldset><br /><br />
104
			<fieldset>
105
				<legend>&nbsp;Hash-Generator&nbsp;</legend>
106
				<form  method="post" name="genhash" action="">
107
					<input type="hidden" name="action" value="hash" />
108
					<label for="pass">Enter Text to hash</label><br />
109
					<input type="text" id="pass" name="pass" value="<?php echo $pass; ?>" onkeypress="clearHash();" /><br />
110
					<label for="hash">Hash to copy</label><br />
111
					<input type="text" id="hash" name="hash" value="<?php echo $hash; ?>" readonly="readonly" /><br /><br />
112
					<input name="submit" id="submit0" type="submit" value="calculate hash" />
113
				</form>
114
			</fieldset>
115
		</div>
116
	</body>
117
</html>
118

    
(5-5/6)