<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=HMAC</id>
	<title>HMAC - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=HMAC"/>
	<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=HMAC&amp;action=history"/>
	<updated>2026-06-20T11:16:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.12</generator>
	<entry>
		<id>https://charlesreid1.com/w/index.php?title=HMAC&amp;diff=30704&amp;oldid=prev</id>
		<title>Admin: Create HMAC page with Python code example following AES page format (via create-page on MediaWiki MCP Server)</title>
		<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=HMAC&amp;diff=30704&amp;oldid=prev"/>
		<updated>2026-06-20T03:49:07Z</updated>

		<summary type="html">&lt;p&gt;Create HMAC page with Python code example following AES page format (via create-page on MediaWiki MCP Server)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
import hmac&lt;br /&gt;
import hashlib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def hmac_sha256(key, message):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return the HMAC-SHA256 hex digest.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    return hmac.new(key, message, hashlib.sha256).hexdigest()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def hmac_sha256_verify(key, message, signature):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Constant-time comparison of HMAC-SHA256 digests.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    expected = hmac.new(key, message, hashlib.sha256).hexdigest()&lt;br /&gt;
    return hmac.compare_digest(expected, signature)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;#039;__main__&amp;#039;:&lt;br /&gt;
    key = b&amp;#039;shared_secret&amp;#039;&lt;br /&gt;
    message = b&amp;#039;This is a test&amp;#039;&lt;br /&gt;
&lt;br /&gt;
    sig = hmac_sha256(key, message)&lt;br /&gt;
    print(&amp;quot;HMAC-SHA256 was &amp;#039;%s&amp;#039;&amp;quot; % sig)&lt;br /&gt;
    print(&amp;quot;Verified: %s&amp;quot; % hmac_sha256_verify(key, message, sig))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[RSA]] – asymmetric encryption, decryption, and signing&lt;br /&gt;
&lt;br /&gt;
{{CryptoFlag}}&lt;br /&gt;
&lt;br /&gt;
{{PythonFlag}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Encryption]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>