<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Avash Karn</title>
    <description>The latest articles on DEV Community by Avash Karn (@avash_karn).</description>
    <link>https://dev.to/avash_karn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3933233%2F56290230-cdb4-4f0e-9175-c3fe094af7d9.png</url>
      <title>DEV Community: Avash Karn</title>
      <link>https://dev.to/avash_karn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/avash_karn"/>
    <language>en</language>
    <item>
      <title>Building an E2EE Chat App in Flask - Part 2: Secure Password Storage</title>
      <dc:creator>Avash Karn</dc:creator>
      <pubDate>Fri, 22 May 2026 09:26:50 +0000</pubDate>
      <link>https://dev.to/avash_karn/building-an-e2ee-chat-app-in-flask-part-2-secure-password-storage-3god</link>
      <guid>https://dev.to/avash_karn/building-an-e2ee-chat-app-in-flask-part-2-secure-password-storage-3god</guid>
      <description>&lt;p&gt;Hey everyone! Part 1 explained encryption. Now let's secure passwords.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: Plain Text Passwords
&lt;/h2&gt;

&lt;p&gt;In my first version, I stored passwords like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;p_word&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# LOGIN
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is TERRIBLE because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If database leaks, everyone's passwords exposed&lt;/li&gt;
&lt;li&gt;No hashing = no protection&lt;/li&gt;
&lt;li&gt;One breach = account takeover&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Solution: Werkzeug Password Hashing
&lt;/h2&gt;

&lt;p&gt;Use werkzeug.security to hash passwords:&lt;/p&gt;

&lt;h3&gt;
  
  
  Registration:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;werkzeug.security&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;generate_password_hash&lt;/span&gt;

&lt;span class="n"&gt;hashed_password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;generate_password_hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;hashed_password&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Login:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;werkzeug.security&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;check_password_hash&lt;/span&gt;

&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter_by&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="nf"&gt;check_password_hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;logged_in&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
    &lt;span class="c1"&gt;# USER LOGGED IN
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why This Works
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Passwords are hashed (one-way)&lt;/li&gt;
&lt;li&gt;Hash can't be reversed&lt;/li&gt;
&lt;li&gt;Even if leaked, passwords stay safe&lt;/li&gt;
&lt;li&gt;Industry standard&lt;/li&gt;
&lt;li&gt;Built into Flask ecosystem&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;Passwords must NEVER be stored in plain text. Ever.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3 Coming
&lt;/h2&gt;

&lt;p&gt;File uploads and validation.&lt;/p&gt;

&lt;p&gt;Questions? Drop them below!&lt;/p&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Building an E2EE Chat App in Flask - Part 1: Why Encryption Matters</title>
      <dc:creator>Avash Karn</dc:creator>
      <pubDate>Fri, 22 May 2026 07:33:47 +0000</pubDate>
      <link>https://dev.to/avash_karn/building-an-e2ee-chat-app-in-flask-part-1-why-encryption-matters-2lo4</link>
      <guid>https://dev.to/avash_karn/building-an-e2ee-chat-app-in-flask-part-1-why-encryption-matters-2lo4</guid>
      <description>&lt;p&gt;Hey everyone! I'm building an encrypted chat application in Flask and documenting the journey. Here's Part 1.&lt;br&gt;
Why E2EE Matters&lt;br&gt;
Most messaging apps claim to be secure, but they're not. Your messages sit on their servers where anyone with access can read them.&lt;/p&gt;

&lt;p&gt;End-to-End Encryption (E2EE) = only you and the recipient can read messages. The server can't see anything.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
WhatsApp uses E2EE. Facebook Messenger doesn't. Your choice matters.&lt;/p&gt;

&lt;p&gt;Why I Built This&lt;br&gt;
I wanted to understand encryption by building it, not just reading about it. This project taught me way more than any tutorial.&lt;/p&gt;

&lt;p&gt;What's Next&lt;br&gt;
Part 2: How to handle passwords safely without storing them in plain text.&lt;/p&gt;

&lt;p&gt;Questions? Drop them in comments!&lt;/p&gt;

</description>
      <category>privacy</category>
      <category>python</category>
      <category>security</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
