diff options
Diffstat (limited to 'pipermail/pycrypto/2010q4/000324.html')
-rw-r--r-- | pipermail/pycrypto/2010q4/000324.html | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/pipermail/pycrypto/2010q4/000324.html b/pipermail/pycrypto/2010q4/000324.html new file mode 100644 index 0000000..0cd0b7a --- /dev/null +++ b/pipermail/pycrypto/2010q4/000324.html @@ -0,0 +1,116 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> + <HEAD> + <TITLE> [pycrypto] Once again: Python3 with PyCrypto + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Once%20again%3A%20Python3%20with%20PyCrypto&In-Reply-To=4D1539CB.6000600%40gmx.li"> + <META NAME="robots" CONTENT="index,nofollow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000323.html"> + <LINK REL="Next" HREF="000325.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[pycrypto] Once again: Python3 with PyCrypto</H1> + <B>Dwayne C. Litzenberger</B> + <A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Once%20again%3A%20Python3%20with%20PyCrypto&In-Reply-To=4D1539CB.6000600%40gmx.li" + TITLE="[pycrypto] Once again: Python3 with PyCrypto">dlitz at dlitz.net + </A><BR> + <I>Sat Dec 25 10:36:27 CST 2010</I> + <P><UL> + <LI>Previous message: <A HREF="000323.html">[pycrypto] _fastmath.c on 64-bit, compile-time warnings +</A></li> + <LI>Next message: <A HREF="000325.html">[pycrypto] Once again: Python3 with PyCrypto +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#324">[ date ]</a> + <a href="thread.html#324">[ thread ]</a> + <a href="subject.html#324">[ subject ]</a> + <a href="author.html#324">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>I'm on vacation, so I won't be able to look at this until early January, but off the top of my head... does .encode() work in Python 2.1? + +"Thorsten Behrens" <<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">sbehrens at gmx.li</A>> wrote: + +><i>Still crashing, just not on importing winrandom any more. I found the +</I>><i>typo there. More errors remain, clearly. +</I>><i> +</I>><i>I have a question regarding the str/bytes situation in Python 3. Take +</I>><i>this example from Counter.py: +</I>><i> +</I>><i> if sys.version_info[0] is 2: +</I>><i> if little_endian: +</I>><i> return _counter._newLE(str(prefix), str(suffix), initval, +</I>><i>allow_wraparound=allow_wraparound, disable_shortcut=disable_shortcut) +</I>><i> else: +</I>><i> return _counter._newBE(str(prefix), str(suffix), initval, +</I>><i>allow_wraparound=allow_wraparound, disable_shortcut=disable_shortcut) +</I>><i> else: +</I>><i> if little_endian: +</I>><i> return _counter._newLE(prefix.encode(), suffix.encode(), +</I>><i>initval.encode(), allow_wraparound=allow_wraparound, +</I>><i>disable_shortcut=disable_shortcut) +</I>><i> else: +</I>><i> return _counter._newBE(prefix.encode(), suffix.encode(), +</I>><i>initval.encode(), allow_wraparound=allow_wraparound, +</I>><i>disable_shortcut=disable_shortcut) +</I>><i> +</I>><i>Not having had that much exposure to this code, my question is: Would +</I>><i>it +</I>><i>be safe to just use .encode() throughout, without the check for Python +</I>><i>version? From all I can tell, it'll work as desired - but there may be +</I>><i>a +</I>><i>corner case I haven't considered. Essentially, can I collapse the above +</I>><i> +</I>><i>again to: +</I>><i> +</I>><i> if little_endian: +</I>><i> return _counter._newLE(prefix.encode(), suffix.encode(), +</I>><i>initval.encode(), allow_wraparound=allow_wraparound, +</I>><i>disable_shortcut=disable_shortcut) +</I>><i> else: +</I>><i> return _counter._newBE(prefix.encode(), suffix.encode(), +</I>><i>initval.encode(), allow_wraparound=allow_wraparound, +</I>><i>disable_shortcut=disable_shortcut) +</I>><i> +</I>><i>for all versions of Python, 2.x and 3.x. +</I>><i> +</I>><i>Dwayne, can you shed some light? +</I>><i> +</I>><i>Thorsten +</I>><i> +</I>><i>_______________________________________________ +</I>><i>pycrypto mailing list +</I>><i><A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">pycrypto at lists.dlitz.net</A> +</I>><i><A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto</A> +</I> +-- +Sent from my Android phone with K-9 Mail. Please excuse my brevity. +</PRE> + + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000323.html">[pycrypto] _fastmath.c on 64-bit, compile-time warnings +</A></li> + <LI>Next message: <A HREF="000325.html">[pycrypto] Once again: Python3 with PyCrypto +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#324">[ date ]</a> + <a href="thread.html#324">[ thread ]</a> + <a href="subject.html#324">[ subject ]</a> + <a href="author.html#324">[ 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> |