<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[🔑 Encryption vs 🔒 Hashing]]></title><description><![CDATA[<h2>:key:  Encryption <strong>vs</strong>  :shield: Hashing</h2>
<hr />
<p dir="auto"><strong>Introduction</strong></p>
<p dir="auto"><code>Encryption</code> and  <code>Hashing</code>. The two main terms in <code>cryptogrphy</code>. We know both techniques are using to hide actual data in programming. <strong>But</strong>  there are few major differences between.</p>
<p dir="auto">Let's see the very basic concept &amp; difference between <strong>Encryption</strong> and <strong>Hashing</strong>.</p>
<hr />
<p dir="auto"><strong>Encryption</strong></p>
<blockquote>
<p dir="auto">Encryption is the process of using an algorithm to transform information to make it unreadable for unauthorized users. <strong>- Techopedia</strong></p>
</blockquote>
<p dir="auto"><code>Encryption</code> is a kind of algorithm to transform the data to unreadable format <strong>or</strong> specific format that can't be read by anyone else.</p>
<p dir="auto">It looks like,</p>
<p dir="auto"><strong>Before Encrypt -</strong>  Hi, How are you?<br />
<strong>After Encrypt -</strong> dahj963hqd92h2hr2f hf9vb3y9863b52c3569</p>
<p dir="auto">Only the <code>system</code> or <code>specific user</code> can decrypt the data.</p>
<p dir="auto">The lenth of encrypted data depends on the actual data lenth. If you input small data, the encrypted data also will be smaller. If you input huge data, the encrypted data will be larger.</p>
<p dir="auto">The encryption  machanism has two type of keys.</p>
<blockquote>
<p dir="auto"><strong>1. Public Key -</strong> <em>Open key that use to encrypt data.</em><br />
<strong>2. Private Key -</strong> <em>Secret key that use to decrypt the encrypted data.</em></p>
</blockquote>
<p dir="auto"><img src="https://www.dqr-group.com/wp-content/uploads/2018/09/public-private-key.jpg" alt="encryption machanism" class=" img-responsive img-markdown" /></p>
<hr />
<p dir="auto"><strong>Hashing</strong></p>
<p dir="auto"><code>Hashing</code> is also working like <code>encryption</code>. <strong>But</strong>  <code>Hash</code> doesn't have keys like <code>public</code> &amp; <code>private</code>.</p>
<p dir="auto"><strong>And Also</strong>, <code>Hashing</code>'s output doesn't depends on the input size. Its' output will be a fixed size of string.</p>
<p dir="auto">It means, imagine the hashing function <code>hash()</code> returns 32 characters output, The output will not be increased or decresed.</p>
<pre><code>echo hash('a')
0cc175b9c0f1b6a831c399e269772661  //32 chars output

echo hash('Data encryption translates data into another form, or code, so that only people with access to a secret key (formally called a decryption key) or password can read it. Encrypted data is commonly referred to as ciphertext, while unencrypted data is called plaintext. Currently, encryption is one of the most popular and effective data security methods used by organizations. Two main types of data encryption exist - asymmetric encryption, also known as public-key encryption, and symmetric encryption')
fc2a2d702e1af572e4fe4dddb31ccc90  //32 chars output
</code></pre>
<p dir="auto"><img src="https://www.thesslstore.com/blog/wp-content/uploads/2018/08/Hashing.png" alt="hash function" class=" img-responsive img-markdown" /></p>
<p dir="auto"><strong>The another thing is,</strong> We  can't reverse the hash. It means we <code>can</code> hash a data. But we <code>can't</code> get data again from hash.</p>
<hr />
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Encryption</th>
<th>Hashing</th>
</tr>
</thead>
<tbody>
<tr>
<td>Output length not Fixed</td>
<td>Fixed Output length</td>
</tr>
<tr>
<td>Can retrieve data again</td>
<td>Can't retrieve data again</td>
</tr>
<tr>
<td>Use as a trusted data</td>
<td>Use as a trusted and unique identifier</td>
</tr>
</tbody>
</table>
<hr />
<h2>When  use <strong>Encryption</strong> and <strong>Hashing</strong> ?</h2>
<hr />
<p dir="auto">Use cases of <code>hashing</code>,</p>
<ul>
<li>Store Passwords in Database.</li>
<li>Compare file hashes for check damage (Check Sum).</li>
<li>Compare data for difference or changes.</li>
</ul>
<p dir="auto">Use case of <code>encryption</code>,</p>
<ul>
<li>Store sensitive data.</li>
<li>Transfer data over network / internet.</li>
<li>Make dedicated file system / extensions.</li>
</ul>
<hr />
<h3>Thank you!</h3>
<p dir="auto">With :hearts:  B6.</p>
]]></description><link>https://lankadevelopers.lk/topic/102/encryption-vs-hashing</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 21:42:40 GMT</lastBuildDate><atom:link href="https://lankadevelopers.lk/topic/102.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 Jan 2019 07:55:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Mon, 21 Jan 2019 05:06:48 GMT]]></title><description><![CDATA[<p dir="auto">@isuru2014 Thx Bro</p>
]]></description><link>https://lankadevelopers.lk/post/743</link><guid isPermaLink="true">https://lankadevelopers.lk/post/743</guid><dc:creator><![CDATA[b6]]></dc:creator><pubDate>Mon, 21 Jan 2019 05:06:48 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Fri, 18 Jan 2019 08:42:32 GMT]]></title><description><![CDATA[<p dir="auto">Good post</p>
]]></description><link>https://lankadevelopers.lk/post/730</link><guid isPermaLink="true">https://lankadevelopers.lk/post/730</guid><dc:creator><![CDATA[imadusanka]]></dc:creator><pubDate>Fri, 18 Jan 2019 08:42:32 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Wed, 16 Jan 2019 03:49:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/656">@MoRaL</a> Thank you bro</p>
]]></description><link>https://lankadevelopers.lk/post/703</link><guid isPermaLink="true">https://lankadevelopers.lk/post/703</guid><dc:creator><![CDATA[b6]]></dc:creator><pubDate>Wed, 16 Jan 2019 03:49:33 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Wed, 16 Jan 2019 01:31:06 GMT]]></title><description><![CDATA[<p dir="auto">cool explanation broh 🎩</p>
]]></description><link>https://lankadevelopers.lk/post/699</link><guid isPermaLink="true">https://lankadevelopers.lk/post/699</guid><dc:creator><![CDATA[MoRaL]]></dc:creator><pubDate>Wed, 16 Jan 2019 01:31:06 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 16:59:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/2">@dev_lak</a> Thank you bro</p>
]]></description><link>https://lankadevelopers.lk/post/697</link><guid isPermaLink="true">https://lankadevelopers.lk/post/697</guid><dc:creator><![CDATA[b6]]></dc:creator><pubDate>Tue, 15 Jan 2019 16:59:51 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 17:00:11 GMT]]></title><description><![CDATA[<p dir="auto">nice explanation bro...</p>
]]></description><link>https://lankadevelopers.lk/post/696</link><guid isPermaLink="true">https://lankadevelopers.lk/post/696</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Tue, 15 Jan 2019 17:00:11 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 16:32:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/27">@root</a> Yes. The srilanka's stack overflow :)</p>
]]></description><link>https://lankadevelopers.lk/post/693</link><guid isPermaLink="true">https://lankadevelopers.lk/post/693</guid><dc:creator><![CDATA[b6]]></dc:creator><pubDate>Tue, 15 Jan 2019 16:32:02 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 16:31:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/532">@lahirunc</a> Thanks bro</p>
]]></description><link>https://lankadevelopers.lk/post/692</link><guid isPermaLink="true">https://lankadevelopers.lk/post/692</guid><dc:creator><![CDATA[b6]]></dc:creator><pubDate>Tue, 15 Jan 2019 16:31:26 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 16:31:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/130">@lkdev</a> Thank you for your support :)</p>
]]></description><link>https://lankadevelopers.lk/post/691</link><guid isPermaLink="true">https://lankadevelopers.lk/post/691</guid><dc:creator><![CDATA[b6]]></dc:creator><pubDate>Tue, 15 Jan 2019 16:31:13 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 16:02:52 GMT]]></title><description><![CDATA[<p dir="auto">good work bro.. lankadevelopers are making a huge IT world in Sri Lanka</p>
]]></description><link>https://lankadevelopers.lk/post/689</link><guid isPermaLink="true">https://lankadevelopers.lk/post/689</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Tue, 15 Jan 2019 16:02:52 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 15:26:55 GMT]]></title><description><![CDATA[<p dir="auto">Nice Work! Keep up!</p>
]]></description><link>https://lankadevelopers.lk/post/685</link><guid isPermaLink="true">https://lankadevelopers.lk/post/685</guid><dc:creator><![CDATA[lahirunc]]></dc:creator><pubDate>Tue, 15 Jan 2019 15:26:55 GMT</pubDate></item><item><title><![CDATA[Reply to 🔑 Encryption vs 🔒 Hashing on Tue, 15 Jan 2019 12:59:49 GMT]]></title><description><![CDATA[<p dir="auto">Good explanation, keep posting good luck</p>
]]></description><link>https://lankadevelopers.lk/post/681</link><guid isPermaLink="true">https://lankadevelopers.lk/post/681</guid><dc:creator><![CDATA[lkdev]]></dc:creator><pubDate>Tue, 15 Jan 2019 12:59:49 GMT</pubDate></item></channel></rss>