summaryrefslogtreecommitdiff
path: root/pipermail/pycrypto/2015q1/000833.html
diff options
context:
space:
mode:
Diffstat (limited to 'pipermail/pycrypto/2015q1/000833.html')
-rw-r--r--pipermail/pycrypto/2015q1/000833.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/pipermail/pycrypto/2015q1/000833.html b/pipermail/pycrypto/2015q1/000833.html
new file mode 100644
index 0000000..dfdd7ff
--- /dev/null
+++ b/pipermail/pycrypto/2015q1/000833.html
@@ -0,0 +1,100 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE> [pycrypto] Why does PyCrypto not produce the same ciphertext as OpenSSL in this example (AES-128 ECB)
+ </TITLE>
+ <LINK REL="Index" HREF="index.html" >
+ <LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20Why%20does%20PyCrypto%20not%20produce%20the%20same%20ciphertext%20as%0A%20OpenSSL%20in%20this%20example%20%28AES-128%20ECB%29&In-Reply-To=%3CCAMp7mVurt-kQetrcEZtVtz-aJ721WoahjXmKyfySRczu-BmXWA%40mail.gmail.com%3E">
+ <META NAME="robots" CONTENT="index,nofollow">
+ <style type="text/css">
+ pre {
+ white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
+ }
+ </style>
+ <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
+ <LINK REL="Previous" HREF="000832.html">
+
+ </HEAD>
+ <BODY BGCOLOR="#ffffff">
+ <H1>[pycrypto] Why does PyCrypto not produce the same ciphertext as OpenSSL in this example (AES-128 ECB)</H1>
+ <B>Richard Moore</B>
+ <A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20Why%20does%20PyCrypto%20not%20produce%20the%20same%20ciphertext%20as%0A%20OpenSSL%20in%20this%20example%20%28AES-128%20ECB%29&In-Reply-To=%3CCAMp7mVurt-kQetrcEZtVtz-aJ721WoahjXmKyfySRczu-BmXWA%40mail.gmail.com%3E"
+ TITLE="[pycrypto] Why does PyCrypto not produce the same ciphertext as OpenSSL in this example (AES-128 ECB)">richmoore44 at gmail.com
+ </A><BR>
+ <I>Sat Feb 21 07:38:05 PST 2015</I>
+ <P><UL>
+ <LI>Previous message: <A HREF="000832.html">[pycrypto] Why does PyCrypto not produce the same ciphertext as OpenSSL in this example (AES-128 ECB)
+</A></li>
+
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#833">[ date ]</a>
+ <a href="thread.html#833">[ thread ]</a>
+ <a href="subject.html#833">[ subject ]</a>
+ <a href="author.html#833">[ author ]</a>
+ </LI>
+ </UL>
+ <HR>
+<!--beginarticle-->
+<PRE>On 21 February 2015 at 15:08, James McMurray &lt;<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">jamesmcm03 at gmail.com</A>&gt; wrote:
+
+&gt;<i> Hi,
+</I>&gt;<i>
+</I>&gt;<i> If I run the following, for openSSL:
+</I>&gt;<i>
+</I>&gt;<i> echo -n &quot;0123456789abcdef0123456789abcdef&quot; | openssl aes-128-ecb
+</I>&gt;<i> -nosalt -nopad | xxd
+</I>&gt;<i>
+</I>&gt;<i> and enter the key &quot;YELLOW SUBMARINE&quot;, I get the following ciphertext:
+</I>&gt;<i>
+</I>&gt;<i> a2a5 8316 129f c596 8341 c78a 0c36 5d20
+</I>&gt;<i> a2a5 8316 129f c596 8341 c78a 0c36 5d20
+</I>&gt;<i>
+</I>&gt;<i> Yet in PyCrypto, the following code:
+</I>&gt;<i>
+</I>&gt;<i> from Crypto.Cipher import AES
+</I>&gt;<i> key = b'YELLOW SUBMARINE'
+</I>&gt;<i> cipher = AES.new(key, AES.MODE_ECB, &quot;&quot;)
+</I>&gt;<i> msg = cipher.encrypt(b'0123456789abcdef0123456789abcdef')
+</I>&gt;<i>
+</I>&gt;<i> Outputs:
+</I>&gt;<i>
+</I>&gt;<i> 20 1e 80 2f 7b 6a ce 6f 6c d0 a7 43 ba 78 ae ad
+</I>&gt;<i> 20 1e 80 2f 7b 6a ce 6f 6c d0 a7 43 ba 78 ae ad
+</I>&gt;<i>
+</I>&gt;<i> (line breaks added for clarity)
+</I>&gt;<i>
+</I>&gt;<i> What is the cause of this discrepancy? Both are 128-bit AES in ECB
+</I>&gt;<i> mode. PyCrypto doesn't appear to be salting, and padding should be
+</I>&gt;<i> unnecessary in any case with this plaintext.
+</I>&gt;<i>
+</I>
+OpenSSL doesn't use the passphrase directly, it applies a key derivation
+function to it. Use -K to specify a key explicitly (as a string of hex).
+
+Cheers
+
+Rich.
+-------------- next part --------------
+An HTML attachment was scrubbed...
+URL: &lt;<A HREF="http://lists.dlitz.net/pipermail/pycrypto/attachments/20150221/b45aefe1/attachment.html">http://lists.dlitz.net/pipermail/pycrypto/attachments/20150221/b45aefe1/attachment.html</A>&gt;
+</PRE>
+
+<!--endarticle-->
+ <HR>
+ <P><UL>
+ <!--threads-->
+ <LI>Previous message: <A HREF="000832.html">[pycrypto] Why does PyCrypto not produce the same ciphertext as OpenSSL in this example (AES-128 ECB)
+</A></li>
+
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#833">[ date ]</a>
+ <a href="thread.html#833">[ thread ]</a>
+ <a href="subject.html#833">[ subject ]</a>
+ <a href="author.html#833">[ author ]</a>
+ </LI>
+ </UL>
+
+<hr>
+<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto
+mailing list</a><br>
+</body></html>