<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Python: Cryptography Caesar shift encryption (shift cipher)</title>
	<atom:link href="http://www.stealthcopter.com/blog/2009/12/python-cryptography-caesar-shift-encryption-shift-cipher/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stealthcopter.com/blog/2009/12/python-cryptography-caesar-shift-encryption-shift-cipher/</link>
	<description>Android, Linux, Python and stealthcopters</description>
	<lastBuildDate>Thu, 09 Sep 2010 13:38:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: mat</title>
		<link>http://www.stealthcopter.com/blog/2009/12/python-cryptography-caesar-shift-encryption-shift-cipher/comment-page-1/#comment-59</link>
		<dc:creator>mat</dc:creator>
		<pubDate>Tue, 22 Dec 2009 19:20:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=271#comment-59</guid>
		<description>Thanks wumzi, I&#039;ve rewritten the caesar and substitution ciphers to use the maketrans function. The new functions can be found &lt;a href=&quot;http://www.stealthcopter.com/blog/2009/12/python-cryptograph-using-maketrans-for-substitution-and-caesar-ciphers/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Thanks wumzi, I&#8217;ve rewritten the caesar and substitution ciphers to use the maketrans function. The new functions can be found <a href="http://www.stealthcopter.com/blog/2009/12/python-cryptograph-using-maketrans-for-substitution-and-caesar-ciphers/" rel="nofollow">here</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wumzi</title>
		<link>http://www.stealthcopter.com/blog/2009/12/python-cryptography-caesar-shift-encryption-shift-cipher/comment-page-1/#comment-58</link>
		<dc:creator>wumzi</dc:creator>
		<pubDate>Tue, 22 Dec 2009 15:51:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=271#comment-58</guid>
		<description>@mat:

Sorry, there&#039;s mistakes in the code, i just translated the names in english before posting it , and moreover there&#039;s no indentation :)

But, it&#039;s now posted on my wiki : http://www.wumzi.info/wiki/doku.php?id=decodeur_de_code_cesar

Yes, I&#039;m from France</description>
		<content:encoded><![CDATA[<p>@mat:</p>
<p>Sorry, there&#8217;s mistakes in the code, i just translated the names in english before posting it , and moreover there&#8217;s no indentation <img src='http://www.stealthcopter.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>But, it&#8217;s now posted on my wiki : <a href="http://www.wumzi.info/wiki/doku.php?id=decodeur_de_code_cesar" rel="nofollow">http://www.wumzi.info/wiki/doku.php?id=decodeur_de_code_cesar</a></p>
<p>Yes, I&#8217;m from France</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mat</title>
		<link>http://www.stealthcopter.com/blog/2009/12/python-cryptography-caesar-shift-encryption-shift-cipher/comment-page-1/#comment-56</link>
		<dc:creator>mat</dc:creator>
		<pubDate>Mon, 21 Dec 2009 21:03:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=271#comment-56</guid>
		<description>@wumzi: shift is passed to the function caesar(plaintext,shift) and defines how far the transposed alphabet is moved. IE shift=0 a=a b=b, shift=1 a=b b=c etc.... Also thanks for your code, I&#039;ll give it a try after I write my own version :)

@Ulrik: Cheers for the link, that looks like a simpler solution however I don&#039;t think it could be used for the customizations that I&#039;d like to include in future versions (such as methods for defeating frequency analysis)</description>
		<content:encoded><![CDATA[<p>@wumzi: shift is passed to the function caesar(plaintext,shift) and defines how far the transposed alphabet is moved. IE shift=0 a=a b=b, shift=1 a=b b=c etc&#8230;. Also thanks for your code, I&#8217;ll give it a try after I write my own version <img src='http://www.stealthcopter.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>@Ulrik: Cheers for the link, that looks like a simpler solution however I don&#8217;t think it could be used for the customizations that I&#8217;d like to include in future versions (such as methods for defeating frequency analysis)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ulrik</title>
		<link>http://www.stealthcopter.com/blog/2009/12/python-cryptography-caesar-shift-encryption-shift-cipher/comment-page-1/#comment-55</link>
		<dc:creator>Ulrik</dc:creator>
		<pubDate>Mon, 21 Dec 2009 20:06:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=271#comment-55</guid>
		<description>All substitution ciphers are easily expressed with Python&#039;s str.translate or unicode.translate that basically work with explicit subsitutions. 

See http://stackoverflow.com/questions/1538935/caesars-cipher-using-python-could-use-a-little-help/1539611#1539611</description>
		<content:encoded><![CDATA[<p>All substitution ciphers are easily expressed with Python&#8217;s str.translate or unicode.translate that basically work with explicit subsitutions. </p>
<p>See <a href="http://stackoverflow.com/questions/1538935/caesars-cipher-using-python-could-use-a-little-help/1539611#1539611" rel="nofollow">http://stackoverflow.com/questions/1538935/caesars-cipher-using-python-could-use-a-little-help/1539611#1539611</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wumzi</title>
		<link>http://www.stealthcopter.com/blog/2009/12/python-cryptography-caesar-shift-encryption-shift-cipher/comment-page-1/#comment-54</link>
		<dc:creator>wumzi</dc:creator>
		<pubDate>Mon, 21 Dec 2009 20:03:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.stealthcopter.com/blog/?p=271#comment-54</guid>
		<description>Hi !
Your code is very clean, but i don&#039;t understand line 9 : what&#039;s &quot;shift&quot; ? You didn&#039;t create any variable named after this ...

Instead of a dictionnary, you could have used a string in order to run the string.translate() method instead of lines 13-17.

I made a caesar decoder, which use a dictionnary of words to decode :

#!/usr/bin/env python
import string       

def decode (n, text):

         #First, we build the coded-alphabet for n substitutions
	alphabet= &#039;abcdefghijklmnopqrstuvwzyz&#039;
	alphabet_code = &#039;&#039;&quot;
	for x in range (0, len(alphabet)):
		d = 0
		for y in range (0, n+1):
			if x+y -d &gt; 25:
				x=0
				d = y
			letter=alphabet[x +y -d]
			y += 1
		alphabet_code += letter
		x += 1

	table = string.maketrans(alphbet_code , alphabet) #Decoding
	
        #Then, by checking every decoded word with a dictionnary, we check if the decoded string is the right
	decode=text.translate(table)
	file=open(&#039;dictionnary.txt&#039; , &#039;r&#039;)
	words= file.readlines()
	good=0
	for x in words:
		if x[0:-1] in decode and len(x) &gt; 3:
			good += 1
	if bon &gt; 1:
		print decode
	file.close()

if __name__ == &#039;__main__&#039;:
	text = raw_input(&#039;Enter the Caesar message to decode&#039;).lower()
	for z in range (1, 27):
		decode ( z , text)
		z += 1</description>
		<content:encoded><![CDATA[<p>Hi !<br />
Your code is very clean, but i don&#8217;t understand line 9 : what&#8217;s &#8220;shift&#8221; ? You didn&#8217;t create any variable named after this &#8230;</p>
<p>Instead of a dictionnary, you could have used a string in order to run the string.translate() method instead of lines 13-17.</p>
<p>I made a caesar decoder, which use a dictionnary of words to decode :</p>
<p>#!/usr/bin/env python<br />
import string       </p>
<p>def decode (n, text):</p>
<p>         #First, we build the coded-alphabet for n substitutions<br />
	alphabet= &#8216;abcdefghijklmnopqrstuvwzyz&#8217;<br />
	alphabet_code = &#8221;&#8221;<br />
	for x in range (0, len(alphabet)):<br />
		d = 0<br />
		for y in range (0, n+1):<br />
			if x+y -d &gt; 25:<br />
				x=0<br />
				d = y<br />
			letter=alphabet[x +y -d]<br />
			y += 1<br />
		alphabet_code += letter<br />
		x += 1</p>
<p>	table = string.maketrans(alphbet_code , alphabet) #Decoding</p>
<p>        #Then, by checking every decoded word with a dictionnary, we check if the decoded string is the right<br />
	decode=text.translate(table)<br />
	file=open(&#8216;dictionnary.txt&#8217; , &#8216;r&#8217;)<br />
	words= file.readlines()<br />
	good=0<br />
	for x in words:<br />
		if x[0:-1] in decode and len(x) &gt; 3:<br />
			good += 1<br />
	if bon &gt; 1:<br />
		print decode<br />
	file.close()</p>
<p>if __name__ == &#8216;__main__&#8217;:<br />
	text = raw_input(&#8216;Enter the Caesar message to decode&#8217;).lower()<br />
	for z in range (1, 27):<br />
		decode ( z , text)<br />
		z += 1</p>
]]></content:encoded>
	</item>
</channel>
</rss>
