Welcome Guest [Log In] [Register]
Welcome to Crypto. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
A tutorial in programming crypto with Python
Topic Started: Jul 23 2009, 01:37 AM (10,843 Views)
jdege
Member Avatar
NSA worthy
[ *  *  *  *  *  * ]
We were talking about introductory tutorials in programming for crypto, with mention of Python.

After some discussion of what I thought was often missing from introductory tutorials, I decided to write one myself.

It's starting with a somewhat higher expectation of background. It assumes you know a bit about programming, and have some familiarity with cryptanalysis of simple substitution ciphers.

Crypto Programming using Python
When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post Goto Top
 
mosher
Super member
[ *  *  *  * ]
Although I have not yet had the opportunity to work through the tutorial step-by-step, it is very impressive. It has a clean format, is informative, and carries a lot of "from the trenches" tips. There is plenty of "meat on the bones" -- well done!
Offline Profile Quote Post Goto Top
 
jdege
Member Avatar
NSA worthy
[ *  *  *  *  *  * ]
The format is docbook's, with a bit of css tweaking.
When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post Goto Top
 
nullsole
Member Avatar
Member
[ *  * ]
jdege
Jul 23 2009, 01:37 AM
We were talking about introductory tutorials in programming for crypto, with mention of Python.

After some discussion of what I thought was often missing from introductory tutorials, I decided to write one myself.

It's starting with a somewhat higher expectation of background. It assumes you know a bit about programming, and have some familiarity with cryptanalysis of simple substitution ciphers.

Crypto Programming using Python
jdege,

Thanks for the new tutorial! I am enjoying it and working my way through it. I'm liking Python, not that I have experience in other languages, but it seems really robust - with some batteries included. I'm drilling myself on learning how to make the language do what I want/need.

Your tutorial is very clear and very useful for starting that tool set the forum has been discussing.

I hope to have a nice block of time over the weekend to really come to terms with all this great Python info! Thanks for putting together such a helpful resource.

These programing tutorials are like the Lanki tutorials -- they will become classic!

Thanks again!

BTW - Had a good laugh at the Python cartoon in the other thread! :lol:
Offline Profile Quote Post Goto Top
 
jdege
Member Avatar
NSA worthy
[ *  *  *  *  *  * ]
I want to thank you for your kind words, but comparing what I've done to Lanaki's lessons is hyperbole of the worst sort. There's a scope and breadth to what he has done that I haven't come close to matching.

When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post Goto Top
 
nullsole
Member Avatar
Member
[ *  * ]
jdege
Jul 28 2009, 04:41 PM
I want to thank you for your kind words, but comparing what I've done to Lanaki's lessons is hyperbole of the worst sort. There's a scope and breadth to what he has done that I haven't come close to matching.

Actually, I was thinking more of the future. Along the lines of what mosher had said:

Quote:
 
osric's excellent Python site was the first of its kid that I had encountered, and jdege has now added his wonderful site, too. These tutorials are not one-time efforts; they will remain on the Web for years to come as a great source of programming education. I hope to free up soon to add my modest contribution (probably in Perl).

It might be a nice idea to have a programming language "snippets" area for each language. For example, there might be a place on this site that collects short, standalone sequences of Python code for doing important functions such as:



”Reading in a text file and normalizing it (i.e., remove spaces, change to uppercase)

”Write out a ciphertext on multiple lines in groups of five

”Take a frequency count

”Generate a numerical key from a keyword


More hoping that many more will be added to the list and that will make it all a collection for the new programmer of classical cipher systems to get a grip on the basics. Didn't mean to offend. Should have been clearer - in that it would be great, and the way the thread developed with mosher and osric and yourself, that maybe a collection would be built and maintained that would *in time*, hopefully, grow and be used as much as and be as important to new programmers in crypto -- as the Lanaki files are to all that begin crypto.

Hope that is a bit clearer.

Offline Profile Quote Post Goto Top
 
nullsole
Member Avatar
Member
[ *  * ]
:o

Ok, maybe Lanaki was a bit much .... however ... you all could work out an updated series of programming exercises and statements to update and refresh -- say the Basic programes of Caxton Foster. NOT the same programs but all the basics one who is trying (like myself and hopefully others) to incorporate pencil and paper to computer.

So far what has been presented has been GREAT!!!

However, being new to programming and having chosen Python (Free all platforms can do a lot batteries included) ......

I'm struggling now with something (I'm sure simple to all of you programmers) but in the approach to things -

For example -- I would love to write a simple aid (Oh, and I'm not even getting into the auto-solvers) but the 'aids' - the first step in moving folks from pencil/paper to letting the computer assist. Anyway -- I've been thing about the Baconian cipher. Now that seems to me to be easy to at least set up in some way to find the crib - to maybe find the confilicts. But I don't know how to approach this.

Us beginners need help in the how to approach these things. Like if you know what you need to do with p/p how do you translate that to the computer.

Does it mean you have to pick a specific language? I don't know. I now most things have been done in Basic , but I don't know basic. And if anyone is interested in bring people new to programming in the loop - today - Basic would not be the choice. Python seems pretty good, but I don't know. It's being used a lot in university for beginning computer science so it must be ok. It's free on all platforms.

Anyway .... I can't succinctly what I'm hoping would come about --- not just for me, but for folks that are on the verge --- they use the computer and want to do some of the tedium/clerical work with computer .... seems to be a good option. But the key thing, that I find hard to find without a specific book (yet to be written!!) is how to approach such problems .... where to start.

Like the simple Baconian -- yes, I can do it with paper and pencil --- but it seems so perfect for a computer setup. Maybe not even the whole solution -- but a way to place the crib --

Anyway ...

I am still struggling to learn Python and am grateful for anything on crypto - ACA crypto in particular - and the pickings are slim.

The two great tutorials already mentioned are WONDERFUL. Honestly - one of you guys/gals need to make a simple ebook or regular book for how to use the computer - this day and age - with the ciphers of ACA -- without giving up all the auto-solver stuff --- but the usual tools and steps one needs to make to all the CE ciphers in order to get them ready to solve.

Just my ramblings ... hope to hear for you all
Offline Profile Quote Post Goto Top
 
jdege
Member Avatar
NSA worthy
[ *  *  *  *  *  * ]
nullsole
Sep 18 2009, 01:14 AM
The two great tutorials already mentioned are WONDERFUL. Honestly - one of you guys/gals need to make a simple ebook or regular book for how to use the computer - this day and age - with the ciphers of ACA -- without giving up all the auto-solver stuff --- but the usual tools and steps one needs to make to all the CE ciphers in order to get them ready to solve.
Actually, I've been thinking about doing exactly that, for a couple of years, now. The problem is that I keep finding more stuff I need to learn before I'll be ready to write it.
When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post Goto Top
 
mosher
Super member
[ *  *  *  * ]
nullsole,

I just received a notification to ACA members, written by David Lambert, which may interest you and others:

Quote:
 
Blog Entry
Creating an interactive cryptogram solver
Sep 19, '09 8:14 PM
by David Lambert for group cryptogram

For anyone who is interested in using computers to assist in your Cryptogram solving, I have started a series of blog posts detailing how to create an extensible interactive cryptogram solver using python. I choose python for its ease of use and availability but the ideas and methods can be used in any programming language. Hopefully someone will find this information useful.

The blog posts will be available on my blog (http://www.codepenguin.net) as they are released (The introduction and Part I are available now) over the next few weeks. If you are interested, please start with the Introduction. Any comments, suggestions or ideas are greatly appreciated.

Disclaimer: I am still a pretty new member of the ACA so everything is written from my own personal experiences, processes and knowledge. I do not claim to be an expert on Cryptography or Programming. I just want to share what I can with others and hopefully learn more in the process.

Enjoy,

Moshe
Offline Profile Quote Post Goto Top
 
nullsole
Member Avatar
Member
[ *  * ]
jdege
Sep 18 2009, 04:16 AM
nullsole
Sep 18 2009, 01:14 AM
The two great tutorials already mentioned are WONDERFUL. Honestly - one of you guys/gals need to make a simple ebook or regular book for how to use the computer - this day and age - with the ciphers of ACA -- without giving up all the auto-solver stuff --- but the usual tools and steps one needs to make to all the CE ciphers in order to get them ready to solve.
Actually, I've been thinking about doing exactly that, for a couple of years, now. The problem is that I keep finding more stuff I need to learn before I'll be ready to write it.
Since this was posted, I have since taken several MOOC python/computer science courses with the last one being the MIT 6.001x - 6.002x courses. I also took two linear algebra courses and a few other math oriented ones.

I was hoping there were more available -- and in particular, Jdege, was wondering if you ever got to that ebook that was mentioned in this thread?

Seriously, after several courses (MOOC) I revisited your tutorial, and I was able to grasp so much more and also learn so much more about classes and what-not with Pyhton.

Mostly I wanted to thank you for making the tutorial and hope you will continue with the idea of making an ebook (or other) on solving classical ciphers with Python - or better - something about the tools needed for solving ciphers.

This time around I got the most from your tutorial on the part about programming the IC and the FREQ analysis. Not that I haven't been able to do freq analysis before -- but the 'special' needs of a particular cipher were in terms of using the IC and frequency analysis were wonderful.

Anyway, hope the ebook/book on this is still going on .... If classical cryptanalysis is to survive, I think we need the direction of making tools for our hobby in a current general language (python).



Offline Profile Quote Post Goto Top
 
jdege
Member Avatar
NSA worthy
[ *  *  *  *  *  * ]
I've piled so much stuff on my "I have to do that someday" pile, I have little hope of ever getting around to it.
When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Tutorials · Next Topic »
Add Reply