<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>All Free Tech &#187; password</title>
	<atom:link href="http://www.allfreetech.com/tag/password/feed" rel="self" type="application/rss+xml" />
	<link>http://www.allfreetech.com</link>
	<description>For developers</description>
	<lastBuildDate>Tue, 01 Feb 2011 13:45:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>How To Assign A Strong Sa Password For Sql Server 2000?</title>
		<link>http://www.allfreetech.com/database/how-to-assign-a-strong-sa-password-for-sql-server-2000-487.html</link>
		<comments>http://www.allfreetech.com/database/how-to-assign-a-strong-sa-password-for-sql-server-2000-487.html#comments</comments>
		<pubDate>Sat, 19 Jun 2010 07:03:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[2000]]></category>
		<category><![CDATA[Assign]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Strong]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/?p=487</guid>
		<description><![CDATA[an administrator to install SQL Server Desktop Engine has a strong password to SQL Server to assign from a safety point of view. SQL databases are repositories of various critical data of a company. You can not do simply fall victim to any kind of illegal or illegitimate use, with weak or easily guessed passwords. [...]]]></description>
			<content:encoded><![CDATA[<p>an administrator to install SQL Server Desktop Engine has a strong password to SQL Server to assign from a safety point of view. SQL databases are repositories of various critical data of a company. You can not do simply fall victim to any kind of illegal or illegitimate use, with weak or easily guessed passwords. This article throws a light on how to specify a strong SA (system administrator) password when you install SQL Server Desktop Engine light. MSDE 2000 is the other name for SQL Server Desktop Engine.</p>
<p>. MDF files are also protected by passwords to prevent unauthorized use. Sometimes the complexity forgotten password in SQL results in an administrator or user, or lost it, that he just forgot. In such times, <strong> SQL Server Password Recovery software proves to be the elixir of life. </strong></p>
<p>Even if use of the SQL instance Windows Authentication, you need a strong password. We know that when using Windows Authentication, the SA account is not used by any user. But the current instance can later be switched to Mixed Mode, then the SA account is active log. Therefore, it is recommended that you should not assign the password blank or null. There should be a strong encryption.</p>
<p>If the SA (SQL Authentication login) account has a blank password, simple or known when an instance of MSDE 2000 to mixed mode, the MSDE instance is then easily switched by unauthorized users be accessed. The sa account can not be deleted, and it must always be protected with a secure password to restrict unauthorized access. Any user who has access to an instance of MSDE 2000 profits indirectly receive full control over the instance of MSDE, and have the option, all resources, the MSDE service account access.</p>
<p>To avoid such circumstances, you can use custom application code to install MSDE or SQL Server Desktop Engine. For that to observe the given points.</p>
<p>up if the user wanted to use MSDE in Mixed Mode, and will apply for the sa account a strong password for the sa account of the user. Use this new password in the MSDE setup. If the SA account is not used, generates a random string, and then pass that string as the SA password to the MSDE setup. If you somehow forget the password SQL Server database, or have lost the SQL Server database. MDF forget, you need to recover the SQL Server password immediately. What was your approach with such a delicate situation where you do not want the security of SQL database compromise? umzugehenMit SQL Server Password Recovery Software is available at recovering lost / forgotten passwords from master help file. MDF from SQL Server database. Even the multilingual passwords are recovered instantly using the software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/database/how-to-assign-a-strong-sa-password-for-sql-server-2000-487.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password Hashing</title>
		<link>http://www.allfreetech.com/php/password-hashing-57.html</link>
		<comments>http://www.allfreetech.com/php/password-hashing-57.html#comments</comments>
		<pubDate>Sat, 23 Jan 2010 03:23:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[password]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/?p=57</guid>
		<description><![CDATA[In this article I&#39;m going to cover password hashing, a subject which is often poorly understood by newer developers. Recently I&#39;ve been asked to look at several web applications which all had the same security issue &#8211; user profiles stored in a database with plain text passwords. Password hashing is a way of encrypting a [...]]]></description>
			<content:encoded><![CDATA[<p>In this article I&#39;m going to cover password hashing, a subject which is often poorly understood by newer developers. Recently I&#39;ve been asked to look at several web applications which all had the same security issue &#8211; user profiles stored in a database with plain text passwords. Password hashing is a way of encrypting a password before it&#39;s stored so that if your database gets into the wrong hands, the damage is limited. Hashing is nothing new &#8211; it&#39;s been in use in Unix system password files since long before my time, and quite probably in other systems long before that. In this article I&#39;ll explain what a hash is, why you want to use them instead of storing real passwords in your applications, and give you some examples of how to implement password hashing in PHP and MySQL.<span id="more-57"></span></p>
<h2>Foreword</h2>
<p>As you read on you&#39;ll see that I advocate the use of a hashing algorithm called Secure Hashing Algorithm 1 (or SHA-1). Since I wrote this article, a team of researchers &#8211; Xiaoyun Wang, Yiqun Lisa Yin, and Hongbo Yu &#8211; have shown SHA-1 to be weaker than was previously thought. This means that for certain purposes such as digital signatures, stronger algorithms like SHA-256 and SHA-512 are now being recommended. For generating password hashes, SHA-1 still provides a more than adequate level of security for most applications today. You should be aware of this issue however and begin to think about using stronger algorithms in your code as they become more readily available.</p>
<p>For more information please see Bruce Schneier&#39;s analysis of the issue at <a href="http://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html">http://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html</a></p>
<h2>What Is A Hash?</h2>
<p>A hash (also called a hash code, digest, or message digest) can be thought of as the digital fingerprint of a piece of data. You can easily generate a fixed length hash for any text string using a one-way mathematical process. It is next to impossible to (efficiently) recover the original text from a hash alone. It is also vastly unlikely that any different text string will give you an identical hash &#8211; a &#39;hash collision&#39;. These properties make hashes ideally suited for storing your application&#39;s passwords. Why? Because although an attacker may compromise a part of your system and reveal your list of password hashes, they can&#39;t determine from the hashes alone what the real passwords are.</p>
<h2>So How Do I Authenticate Users?</h2>
<p>We&#39;ve established that it&#39;s incredibly difficult to recover the original password from a hash, so how will your application know if a user has entered the correct password or not? Quite simply &#8211; by generating a hash of the user-supplied password and comparing this &#39;fingerprint&#39; with the hash stored in your user profile, you&#39;ll know whether or not the passwords match. Let&#39;s look at an example:</p>
<h2>User Registration And Password Verification</h2>
<p>During the registration process our new user will provide their desired password (preferably with verification and through a secure session). Using code similar to the following, we store their username and password hash in our database:</p>
<p><img src="http://phpsec.org/articles/images/2005/password-hashing-01.png" /></p>
<p>Figure 1. Our user enters their preferred access details</p>
<pre class="code">&lt;?php

/* Store user details */

$passwordHash = sha1($_POST[&#39;password&#39;]);

$sql = &#39;INSERT INTO user (username,passwordHash) VALUES (?,?)&#39;;
$result = $db-&gt;query($sql, array($_POST[&#39;username&#39;], $passwordHash));

?&gt;</pre>
<p>The next time our user logs in, we check their access credentials using similar code as follows:</p>
<p><img src="http://phpsec.org/articles/images/2005/password-hashing-02.png" /></p>
<p>Figure 2. Logging back in</p>
<pre class="code">&lt;?php

/* Check user details */

$passwordHash = sha1($_POST[&#39;password&#39;]);

$sql = &#39;SELECT username FROM user WHERE username = ? AND passwordHash = ?&#39;;
$result = $db-&gt;query($sql, array($_POST[&#39;username&#39;], $passwordHash));
if ($result-&gt;numRows() &lt; 1)
{
    /* Access denied */
    echo &#39;Sorry, your username or password was incorrect!&#39;;
}
else
{
    /* Log user in */
    printf(&#39;Welcome back %s!&#39;, $_POST[&#39;username&#39;]);
}

?&gt;</pre>
<h2>Types Of Hashes</h2>
<p>There are a number of strong hashing algorithms in use, the most common of which are MD5 and SHA-1. Older systems &#8211; including many Linux variants &#8211; used Data Encryption Standard (DES) hashes. With only 56 bits this is no longer considered an acceptably strong hashing algorithm and should be avoided.</p>
<h3>Examples</h3>
<p>In PHP you can generate hashes using the <tt>md5()</tt> and <tt>sha1</tt> functions. <tt>md5()</tt> returns a 128-bit hash (32 hexadecimal characters), whereas <tt>sha1()</tt> returns a 160-bit hash (40 hexadecimal characters). For example:</p>
<pre class="code">&lt;?php

$string = &#39;PHP &amp; Information Security&#39;;
printf(&quot;Original string: %s\n&quot;, $string);
printf(&quot;MD5 hash: %s\n&quot;, md5($string));
printf(&quot;SHA-1 hash: %s\n&quot;, sha1($string));

?&gt;</pre>
<p>This code will output the following:</p>
<pre class="code">Original string: PHP &amp; Information Security
MD5 hash: 88dd8f282721af2c704e238e7f338c41
SHA-1 hash: b47210605096b9aa0129f88695e229ce309dd362</pre>
<p>In MySQL you can generate hashes internally using the <tt>password()</tt>, <tt>md5()</tt>, or <tt>sha1</tt> functions. <tt>password()</tt> is the function used for MySQL&#39;s own user authentication system. It returns a 16-byte string for MySQL versions prior to 4.1, and a 41-byte string (based on a double SHA-1 hash) for versions 4.1 and up. <tt>md5()</tt> is available from MySQL version 3.23.2 and <tt>sha1()</tt> was added later in 4.0.2.</p>
<pre class="code">mysql&gt; select PASSWORD( &#39;PHP &amp; Information Security&#39; );
+------------------------------------------+
| PASSWORD( &#39;PHP &amp; Information Security&#39; ) |
+------------------------------------------+
| 379693e271cd3bd6                         |
+------------------------------------------+
1 row in set (0.00 sec)

mysql&gt; select MD5( &#39;PHP &amp; Information Security&#39; );
+-------------------------------------+
| MD5( &#39;PHP &amp; Information Security&#39; ) |
+-------------------------------------+
| 88dd8f282721af2c704e238e7f338c41    |
+-------------------------------------+
1 row in set (0.01 sec)</pre>
<p><i>Note: Using MySQL&#39;s <tt>password()</tt> function in your own applications isn&#39;t recommended &#8211; the algorithm used has changed over time and prior to 4.1 was particularly weak.</i></p>
<p>You may decide to use MySQL to calculate your hash rather than PHP. The example of storing our user&#39;s registration details from the previous section then becomes:</p>
<pre class="code">&lt;?php

/* Store user details */

$sql = &#39;INSERT INTO user (username, passwordHash) VALUES (?, SHA1(?))&#39;;
$result = $db-&gt;query($sql, array($_POST[&#39;username&#39;], $_POST[&#39;password&#39;]));

?&gt;</pre>
<h2>Weaknesses</h2>
<p>As a security measure, storing only hashes of passwords in your database will ensure that an attacker&#39;s job is made that much more difficult. Let&#39;s look at the steps they&#39;ll now take in an effort to compromise your system. Assuming that they&#39;ve managed to access your user database and list of hashes, there&#39;s no way that they can then recover the original passwords to your system. Or is there?</p>
<p>The attacker will be able to look at your hashes and immediately know that any accounts with the same password hash must therefore also have the same password. Not such a problem if neither of the account passwords is known &#8211; or is it? A common technique employed to recover the original plain text from a hash is cracking, otherwise known as &#39;brute forcing&#39;. Using this methodology an attacker will generate hashes for numerous potential passwords (either generated randomly or from a source of potential words, for example a dictionary attack). The hashes generated are compared with those in your user database and any matches will reveal the password for the user in question.</p>
<p>Modern computer hardware can generate MD5 and SHA-1 hashes very quickly &#8211; in some cases at rates of thousands per second. Hashes can be generated for every word in an entire dictionary (possibly including alpha-numeric variants) well in advance of an attack. Whilst strong passwords and longer pass phrases provide a reasonable level of protection against such attacks, you cannot always guarantee that your users will be well informed about such practices. It&#39;s also less than ideal that the same password used on multiple accounts (or multiple systems for that matter) will reveal itself with an identical hash.</p>
<h2>Making It Better</h2>
<p>Both of these weaknesses in the hashing strategy can be overcome by making a small addition to our hashing algorithm. Before generating the hash we create a random string of characters of a predetermined length, and prepend this string to our plain text password. Provided the string (called a &quot;salt&quot;) is of sufficient length &#8211; and of course sufficiently random &#8211; the resulting hash will almost certainly be different each time we execute the function. Of course we must also store the salt we&#39;ve used in the database along with our hash but this is generally no more of an issue than extending the width of the field by a few characters.</p>
<p>When we validate a user&#39;s login credentials we follow the same process, only this time we use the salt from our database instead of generating a new random one. We add the user supplied password to it, run our hashing algorithm, then compare the result with the hash stored in that user&#39;s profile.</p>
<pre class="code">&lt;?php

define(&#39;SALT_LENGTH&#39;, 9);

function generateHash($plainText, $salt = null)
{
    if ($salt === null)
    {
        $salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH);
    }
    else
    {
        $salt = substr($salt, 0, SALT_LENGTH);
    }

    return $salt . sha1($salt . $plainText);
}

?&gt;</pre>
<p><i>Note: The function above is limited in that the maximum salt length is 32 characters. You may wish to write your own salt generator to overcome this limit and increase the entropy of the string.</i></p>
<p>Calling <tt>generateHash()</tt> with a single argument (the plain text password) will cause a random string to be generated and used for the salt. The resulting string consists of the salt followed by the SHA-1 hash &#8211; this is to be stored away in your database. When you&#39;re checking a user&#39;s login, the situation is slightly different in that you already know the salt you&#39;d like to use. The string stored in your database can be passed to <tt>generateHash()</tt> as the second argument when generating the hash of a user-supplied password for comparison.</p>
<p>Using a salt overcomes the issue of multiple accounts with the same password revealing themselves with identical hashes in your database. Although two passwords may be the same the salts will almost certainly be different, so the hashes will look nothing alike.</p>
<p>Dictionary attacks with pre-generated lists of hashes will be useless for the same reason &#8211; the attacker will now have to recalculate their entire dictionary for every individual account they&#39;re attempting to crack.</p>
<h2>Summary</h2>
<p>We&#39;ve seen now what hashes are and why you should store them instead of the plain text passwords they represent in your database. The examples above are a starting point and will get you on the right track with using hashes in your PHP applications. A little bit of work now may well mean much less of a headache further down the track!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/php/password-hashing-57.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

