<?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>SHA &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/sha/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 27 Jul 2016 17:44:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.5</generator>
	<item>
		<title>MySQL: Choose Data type and length of the Secure Hash Algorithm (SHA)</title>
		<link>https://www.dbrnd.com/2016/07/mysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha/</link>
					<comments>https://www.dbrnd.com/2016/07/mysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 27 Jul 2016 17:38:47 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[MD5]]></category>
		<category><![CDATA[MySQL Command]]></category>
		<category><![CDATA[MySQL Database Administrator]]></category>
		<category><![CDATA[MySQL Database Designing]]></category>
		<category><![CDATA[MySQL Database Programming]]></category>
		<category><![CDATA[MySQL Error]]></category>
		<category><![CDATA[MySQL Performance Tunning]]></category>
		<category><![CDATA[MySQL Query]]></category>
		<category><![CDATA[MySQL Tips and Tricks]]></category>
		<category><![CDATA[Secure Hash Algorithm]]></category>
		<category><![CDATA[SHA]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1752</guid>

					<description><![CDATA[Generally, we use the MD5 and SHA password encryption algorithm in MySQL Application. The MD5 and SHA password encryption algorithm is very famous for different application. The MySQL also provides a different function to use this method. When we use the hashing algorithm, we should also create a fixed length data type to store encrypted [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fmysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha%2F&amp;linkname=MySQL%3A%20Choose%20Data%20type%20and%20length%20of%20the%20Secure%20Hash%20Algorithm%20%28SHA%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fmysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha%2F&amp;linkname=MySQL%3A%20Choose%20Data%20type%20and%20length%20of%20the%20Secure%20Hash%20Algorithm%20%28SHA%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fmysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha%2F&amp;linkname=MySQL%3A%20Choose%20Data%20type%20and%20length%20of%20the%20Secure%20Hash%20Algorithm%20%28SHA%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fmysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha%2F&amp;linkname=MySQL%3A%20Choose%20Data%20type%20and%20length%20of%20the%20Secure%20Hash%20Algorithm%20%28SHA%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fmysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha%2F&amp;linkname=MySQL%3A%20Choose%20Data%20type%20and%20length%20of%20the%20Secure%20Hash%20Algorithm%20%28SHA%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fmysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha%2F&amp;linkname=MySQL%3A%20Choose%20Data%20type%20and%20length%20of%20the%20Secure%20Hash%20Algorithm%20%28SHA%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fmysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha%2F&#038;title=MySQL%3A%20Choose%20Data%20type%20and%20length%20of%20the%20Secure%20Hash%20Algorithm%20%28SHA%29" data-a2a-url="https://www.dbrnd.com/2016/07/mysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha/" data-a2a-title="MySQL: Choose Data type and length of the Secure Hash Algorithm (SHA)"></a></p><p>Generally, we use the MD5 and SHA password encryption algorithm in MySQL Application.</p>
<p>The MD5 and SHA password encryption algorithm is very famous for different application. The MySQL also provides a different function to use this method.</p>
<blockquote><p>When we use the hashing algorithm, we should also create a fixed length data type to store encrypted string or password.<br />
Whatever our input is, hashing algorithm always produces a result of the same length.<br />
We can use <strong>CHAR or BINARY</strong> data type to store encrypted password.</p></blockquote>
<p>We should choose hashing algorithm base on our requirements because there are different version available with the different bit size.<br />
Generally, SHA-224 is recommended.<br />
<strong>Below is a list of hashing algorithm along with its require bit size.</strong></p>
<ul>
<li>MD5 = 128-bit hash value.</li>
<li>SHA1 = 160-bit hash value.</li>
<li>SHA224 = 224-bit hash value.</li>
<li>SHA256 = 256-bit hash value.</li>
<li>SHA384 = 384-bit hash value.</li>
<li>SHA512 = 512-bit hash value.</li>
</ul>
<p><strong><br />
Below is a small demonstration to create CHAR fixed length data type for different bit hash value. </strong></p>
<p>First, create sample table and data with CHAR fixed length data type.</p><pre class="crayon-plain-tag">CREATE TABLE tbl_PasswordDataType
(
    ID INTEGER
    ,MD5_128_bit CHAR(32)
    ,SHA_160_bit CHAR(40)
    ,SHA_224_bit CHAR(56)
    ,SHA_256_bit CHAR(64)
    ,SHA_384_bit CHAR(96)
    ,SHA_512_bit CHAR(128)
);

INSERT INTO tbl_PasswordDataType
VALUES 
(
	1
	,MD5('Anvesh')
	,SHA1('Anvesh')
	,SHA2('Anvesh',224)
	,SHA2('Anvesh',256)
	,SHA2('Anvesh',384)
	,SHA2('Anvesh',512)
);</pre><p>
<strong>Now check the size of this columns:</strong></p><pre class="crayon-plain-tag">SELECT 
    LENGTH(MD5_128_bit) AS Length_MD5128
    ,LENGTH(SHA_160_bit) AS Length_SHA160
    ,LENGTH(SHA_224_bit) AS Length_SHA224
    ,LENGTH(SHA_256_bit) AS Length_SHA256
    ,LENGTH(SHA_384_bit) AS Length_SHA384
    ,LENGTH(SHA_512_bit) AS Length_SHA512
FROM tbl_PasswordDataType</pre><p>
<strong>The Result:</strong></p>
<p><a href="https://www.dbrnd.com/wp-content/uploads/2016/02/MySQLHashBitValue.png" rel="attachment wp-att-1758"><img decoding="async" class="alignnone wp-image-1758 size-full" title="MySQL Hash Bit Size" src="https://www.dbrnd.com/wp-content/uploads/2016/02/MySQLHashBitValue.png" alt="MySQL Hash Bit Size" width="582" height="49" srcset="https://www.dbrnd.com/wp-content/uploads/2016/02/MySQLHashBitValue.png 582w, https://www.dbrnd.com/wp-content/uploads/2016/02/MySQLHashBitValue-300x25.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/02/MySQLHashBitValue-150x13.png 150w" sizes="(max-width: 582px) 100vw, 582px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/mysql-choose-data-type-and-length-of-the-secure-hash-algorithm-sha/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
