<?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[Wonder]]></title><description><![CDATA[Wonder is a dev blog where i share some interesting projects and guides to help you do it]]></description><link>https://dev.stupif.com</link><image><url>https://cdn.hashnode.com/uploads/logos/69d6ac70707c1ce768788c7d/f1ae2373-4619-4a44-8c55-7b2197782d11.png</url><title>Wonder</title><link>https://dev.stupif.com</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 23:22:39 GMT</lastBuildDate><atom:link href="https://dev.stupif.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How 2FA Actually Works (and why it’s cool)]]></title><description><![CDATA[2FA (Two Factor Authentication) looks complicated, but it's actually really simple once you break it down.
At its core, it uses 2 things:
A realtime element (time):



A secret key:
Example secret key]]></description><link>https://dev.stupif.com/how-2fa-actually-works-and-why-it-s-cool</link><guid isPermaLink="true">https://dev.stupif.com/how-2fa-actually-works-and-why-it-s-cool</guid><dc:creator><![CDATA[TechieJack]]></dc:creator><pubDate>Wed, 08 Apr 2026 20:50:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69d6ac70707c1ce768788c7d/75058913-21ca-420b-9b49-245e6897d7db.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>2FA (Two Factor Authentication) looks complicated, but it's actually really simple once you break it down.</p>
<p>At its core, it uses 2 things:</p>
<p>A realtime element (time):</p>
<iframe width="100%" height="260" style="border:0;display:block;max-width:420px;margin:0 auto">
</iframe>

<p>A secret key:</p>
<pre><code class="language-plaintext">Example secret key:
Bob1234
</code></pre>
<h2>Make your own 2FA generator</h2>
<p>You can actually build your own basic 2FA system in a few lines of code.</p>
<h3>What you need</h3>
<ul>
<li><p>A code editor like <a href="https://code.visualstudio.com/">Visual Studio Code</a></p>
</li>
<li><p><a href="https://www.python.org/">Python</a> installed</p>
</li>
</ul>
<pre><code class="language-python">import time
import hmac
import hashlib
import struct

secret = "Bob1234"

counter = int(time.time() // 30)
counter_bytes = struct.pack("&gt;Q", counter)

h = hmac.new(secret.encode(), counter_bytes, hashlib.sha1).digest()

offset = h[-1] &amp; 0x0F
code = struct.unpack("&gt;I", h[offset:offset+4])[0] &amp; 0x7FFFFFFF
code = code % 1000000

print(str(code).zfill(6))
</code></pre>
<p>When you run this, it will generate and print a 6 digit verification code directly in your terminal.</p>
]]></content:encoded></item></channel></rss>