Slashdot Mirror


Colossus Cipher Challenge Winner On Ada

An anonymous reader writes "Colossus Cipher Challenge winner Joachim Schueth talks about why he settled on Ada as his language of choice to unravel a code transmitted from the Heinz Nixdorf Museum in Germany, from a Lorenz SZ42 Cipher machine (used by the German High Command to relay secret messages during the World War II). 'Ada allowed me to concisely express the algorithms I wanted to implement.'"

49 of 168 comments (clear)

  1. Let the raging tardfight commence by Malevolent+Tester · · Score: 2, Funny

    He should have used a real programming language like Java or VB.Net.

    --
    If you haven't made a developer cry, you've wasted a day.
    1. Re:Let the raging tardfight commence by morgan_greywolf · · Score: 5, Funny

      He should have used a real programming language like Java or VB.Net.
      Pffft. Real men write programs like this:

      $ cat >/bin/myprogram
    2. Re:Let the raging tardfight commence by jellomizer · · Score: 4, Insightful

      For the most part the language doesn't matter that much. ADA, C, C++, PASCAL, BASIC, LISP... Almost every languge can get the job done. It is just a matter on how well it handles different details. I like Python for its List Processing and Top Down Design. Some people like Visual Basic for its ease in creating good interfaces. Some people like C and C++ because they can control the system at a lower level.
      ADA being a government/military based languge I am not to suprised that it won the competition decifering a goverment/military code. (it is more complex then that)

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    3. Re:Let the raging tardfight commence by morgan_greywolf · · Score: 2, Insightful

      In 1997, producing small, fast executables for desktop and database client applications (Delphi's raison d’ètre) mattered a whole lot more than it does today. These days, it's generally far more important to use a tool that lets the programmer be very productive and to produce nice, maintainable code. Both of which Delphi does very well, mind you.

    4. Re:Let the raging tardfight commence by valentingalea · · Score: 3, Funny

      He should have used Brainfuck!

    5. Re:Let the raging tardfight commence by patchvonbraun · · Score: 3, Insightful

      I only found out about the contest a couple of days before it began, and I was away at the time, so I
      couldn't participate in "real time", but I used the
      copies of the sent ciphertexts on the Bletchley
      website.

      I worked away on a lorenz breaker for the SZ42 stuff, written in C. I was able to break
      ciphertext roughly an order of magnitude faster
      than Joachims code. Joachim worked away on his code
      for several weeks in advance of the contest. I had only a couple of days notice.

      I think two things matter in a competition like
          this:

                      o The *appropriateness* of the language
                      o The skills of the coder

      Joachim got all the glory on this one, since he
          was first to announce the breaks. But there are
          probably a number of others who were "close"
          when Joachim announced his break.

    6. Re:Let the raging tardfight commence by megaditto · · Score: 2

      Yeah, but how much choice do they really have in picking those?

      --
      I made myself sad just now

      --
      Obama likes poor people so much, he wants to make more of them.
    7. Re:Let the raging tardfight commence by Hasmanean · · Score: 2, Funny

      Real men don't use constants. They express all quantities in their natural units, (such as the size of the known universe, or the diameter of a hydrogen atom). Needless to say, they do not require constants to convert the answers to meter-kilogram-second units.

      In fact better men than these do not even use equations. They let the laws of physics fall out of their simulations, as evanescent perennial relationships between variables.

      --
      Hasan
    8. Re:Let the raging tardfight commence by john.r.strohm · · Score: 2, Informative

      Joachim also chose to work a much harder problem than you did.

      You worked with the symbolic cyphertexts. He worked with raw baseband audio from the radio receiver, complete with noise.

      You knew this, of course, because you RTFA.

  2. Comparison with Allies cypher machine by Anonymous Coward · · Score: 3, Interesting

    I wonder how easy it would be to break the Allies corresponding machine, the SIGABA (http://www.quadibloc.com/crypto/ro0205.htm). It was stated that during WWII, the Lorenz machine was broken, but the SIGABA wasn't. Of course, given 60 years of computer improvements, it might be possible to break the SIGABA, now.

    1. Re:Comparison with Allies cypher machine by RebornData · · Score: 3, Informative

      Here's a recent cryptanalysis of SIGABA:

      http://www.sjsu.edu/mscs/research/projects/chan_wing-on.pdf

      In normal use, it appears to have had a keyspace of about 48 bits, which is not easy to attack now with a modest distributed effort, but way out of the reach of WWII technology.

      However, a variant of the machine used for communication between the US President and British PM had an effective keyspace of 95+ bits, which (if you have access to some known plaintext) can be reduced to 86 bits, which although shorter than key lengths in common use today is still out of reach.

  3. Type Casting by hroo772 · · Score: 3, Interesting

    For those that know the differences in Ada, its a very strongly typed language which makes it harder for a beginning programmer to pickup. It doesn't allow for type conversion and pretty much enforces strict coding rules. It would make sense that he used this since he would have complete control over what his code did exactly. This wouldn't be the case with java or other languages which allow type conversions easily, which is nice for alot of people, but can definitely lead to issues when not accounted for.

    1. Re:Type Casting by egilhh · · Score: 2, Insightful

      What makes you think that Ada does not allow type conversion?
      "typename(variable)" is pretty easy in my opinion...
      (not much harder than the type cast in other languages: "(typename)variable")

      Ada even has a package called Ada.Unchecked_Conversion if you don't care
      about ensuring the result is within the bounds of the target type...

    2. Re:Type Casting by Zoxed · · Score: 2, Informative

      > It doesn't allow for type conversion

      It does (unchecked_conversion), but never (AFAIK) *implicitly*.

    3. Re:Type Casting by morgan_greywolf · · Score: 2, Insightful

      languages which allow type conversions easily, which is nice for alot of people, but can definitely lead to issues when not accounted for.
      This is, IMHO, both Python's greatest strength and it's greatest weakness as a dynamically-typed language. Sometimes you can get bizarre results if you're not careful. OTOH, once you get the hang of it, you won't make those mistakes.
    4. Re:Type Casting by fitten · · Score: 2, Informative

      That was pretty much my experience... when you finally got the Ada program to compile, it worked... it just sometimes took a lot of work to get it to compile ;) Back then, you had to be explicit in everything you wanted to do, particularly type conversion... of course, you could get around that by just using everything the same type, but if you started out typing everything, if you got your program to compile, you knew that you were always calling the right functions and/or always doing the typecasts you needed to do.

    5. Re:Type Casting by kst · · Score: 2, Informative

      >> It doesn't allow for type conversion

      > It does (unchecked_conversion), but never (AFAIK) *implicitly*.

      Unchecked_Conversion reinterprets the bits of the argument as a value of the specified type.

      Ada also allows ordinary value conversions (for example, converting 3.1 to type Integer yields 3) among sufficiently closely related types; for example, a value of any numeric type can be converted to any other numeric type. It requires such conversions to be explicit in more cases than many other languages.

      And yes, my experience is that it's more common in Ada than in, say, C, for a program to work correctly the first time you get it to compile successfully.

  4. I like the choice. by DrWho520 · · Score: 4, Funny

    Use a masochistic language to break a German code...groovy.

    --
    The cancel button is your friend. Do not hesitate to use it.
  5. Wimp using ASCII by jellomizer · · Score: 2, Funny

    01010111 01101001 01101101 01110000 00100000 01110101 01110011 01101001 01101110 01100111 00100000 01000001 01010011 01000011 01001001 01001001

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    1. Re:Wimp using ASCII by 91degrees · · Score: 2, Informative

      But you're using an ASCII representation of a binary representation of an ASCII string!

      You're using ASCII twice so you're twice the wimp!

  6. ADA Resurgence? by Arakageeta · · Score: 5, Interesting

    Has anyone else started to notice an ADA resurgence? I feel like several years ago the general feeling was "ADA is a backwards language used only on old military projects." Now I read a positive story about ADA every few weeks! Was ADA 2005 that good of a language revision?

    1. Re:ADA Resurgence? by Skeptical1 · · Score: 5, Funny

      Ada is not a backward language. Ada is a palindrome.

    2. Re:ADA Resurgence? by Anonymous Coward · · Score: 3, Interesting

      Ada was considered too complex. By now C++ is orders of magnitudes more complex and still does not do half the things (Ada has had a sane integrated threading model that could be used for message passing constructs, namely actual OO programming techniques, pretty much from the start).

      C++ templates, for example, are just a ripoff of Ada's generics _including_ the Ada angle bracket constraint notation which does not fit at all into C.

      Basically it is like the Unix renaissance after Windows tried to offer everything Unix does, except doing it all wrong and contorted and only borderline operative.

    3. Re:ADA Resurgence? by Barromind · · Score: 5, Informative

      Ada 2005 is comparatively minor (although some changes, like interfaces, are not that minor). The real improvement was Ada 95. The 95 revision managed to standardize many things that C++/java are now settling.

      Ada is not trendy, but it has had built-in portable concurrency and many other killer features for more than a decade. Proper specifications are one of my favs.

      Of course there are other factors, like the lack of good and free compilers. Fortunately now the gcc toolchain has put this to rest. Also there are few libraries. Really few. Binding to C is easy, but still a deterrent for the hobbyist.

      It's emphasis in making maintenance easy over quick programming really pays in the end, not even in the middle/long term but shortly after getting familiar with the language. I find myself much more productive. When something compiles, I'm sure that the only bugs remaining are logical, not some funny pointer or unexpected type conversion or overflow. Nowadays I rarely fire the debugger more than once a month. My C/C++ has improved because Ada forbids the things that are considered bad practices in C/C++, but you still end doing because "you know better".

      I think that Ada is getting now more exposure because, albeit a niche language, Adacore is pushing hard behind it. Also, its SPARK derivative by Praxis has made some headlines with large and difficult projects getting flying marks. SPARK has made static analysis a reality for large projects.

      I'd say that anyone capable of discipline will enjoy the benefits of Ada. It's not the thing for quick hacking, but it is perfect for anything not trivial. Software engineers should love it. I have heard somewhere that it is a safe C++, and I concur: feature-wise is more or less on par, it catches bugs sooner and prevents many typical ones.

      Have I already said that concurrency is built-in and portable :P? And that inter-thread communication is really well done?

    4. Re: ADA Resurgence? by Black+Parrot · · Score: 2, Insightful

      Ada was designed to control "things that can't fail" like aircraft flight controls and nucear power plants, guidance systems of "smart bombs" and soon. Must people don't work in this area. Most people write stuff that runs on desktop machines and web servers. In that environment software error is just expected and tolerated. And that attitude is exactly why the world is filled with crapware.

      We should expect software to work correctly, and take our business elsewhere when it doesn't.

      No one dies if your kitchen faucet squirts the water out sideways, but we don't just shrug it off and live with it.
      --
      Sheesh, evil *and* a jerk. -- Jade
  7. Comment removed by account_deleted · · Score: 3, Funny

    Comment removed based on user account deletion

  8. Re:I had to learn ADA in college by kellyb9 · · Score: 2, Funny

    Actually most colleges don't want to be typecasted a "C++ school" or an "ADA school". It's more important to learn data structures and theory. If you went to a good school, the language something is written is trivial, learning the syntax should not be that difficult.

  9. Compiler price.. by renoX · · Score: 5, Interesting

    I think that the main reason why Ada has 'lost' to C++ is that some time ago, C++ compiler were either cheap or free whereas Ada compiler were expensive.

    Too bad since Ada is 'by default' a language which is more secure than C++..

  10. Software and recorded audio can be found here by puddles · · Score: 2, Informative

    http://www.schlaupelz.de/SZ42/SZ42_software.html

  11. Re:I had to learn ADA in college by Shinmizu · · Score: 3, Funny

    Brian As a cat once told me, "Anonymous Coward, ur doin it wrong."
  12. hmm. by apodyopsis · · Score: 3, Interesting

    I often wondered at the time if this was a fair test?

    I mean the german fellow was near teh transmitting station and got a very good signal and started right away.

    Bletchley Park on the other hand, because of the atmospheric conditions did not get a signal until late in the day and started late. On the other hand the german SW took only 46 seconds.

    I'm not saying that the german fellow should not of won, he did fair and square - but there seemed to be no mention in much of the news at the time of the receiver issues.

    On the plus side, it was excellent publicity for the park and colossus. If only Churchill had not ordered then scrapped then Britain could of led the technological era.

  13. Concise??!! by Lodragandraoidh · · Score: 2, Insightful

    I can't imagine using the words concise and Ada in the same sentence.

    Constricted - maybe. Painful - most certainly.

    --

    Lodragan Draoidh
    The more you explain it, the more I don't understand it. - Mark Twain
    1. Re:Concise??!! by hey! · · Score: 5, Funny

      I can't imagine using the words concise and Ada in the same sentence.


      Perhaps you should read what you just wrote.
      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    2. Re: Concise??!! by Black+Parrot · · Score: 2, Insightful

      I can't imagine using the words concise and Ada in the same sentence. .

      Not concise in spelling out the details of some low-level module, but very concise for higher-level programming, because it made you be precise when implementing the components.

      Once you've worked in an area for several years you end up with a good collection of libraries with clean interfaces, and you find yourself throwing very complex programs together with simple code that "just works", rather than the spaghettied jazzturbation that you usually see when people use other languages.

      No reason you can't write clean complex programs in the language of your choice; it's just that Ada won't let you be a slouch. It makes you do the details right, but once you've done that you can forget the details and deal with concepts instead.

      Admittedly, I used it at the hobbyist level for several years before I realized how to do that.
      --
      Sheesh, evil *and* a jerk. -- Jade
  14. other factors often dominate language choice by _|()|\| · · Score: 4, Interesting

    Like the author of the article, I have a tendency to dabble with a variety of programming languages. I haven't used Ada seriously, but I am intrigued by it, especially in contrast to the looser languages that are currently popular. A lot of bytes have been spilled on the topic of static and dynamic typing, bondage & discipline vs. unit testing, etc. While these discussions often devolve to religious wars, I do think that language matters. Never mind Sapir-Whorf or Turing, some languages are simply more or less pleasurable or powerful for certain tasks.

    That said, often the language itself is not the dominant factor in choosing the language. As nice as (Ada | Erlang | Haskell | Lisp | Ruby) is, it's not going to be my first choice if another language has a readily available library that will make it easier to write the program. I can write web applications in Lisp, but I probably won't. There is probably a parser generator for Ada, but I'd rather use Flex and Bison, or maybe ANTLR. And when it comes to my first choice, independent of problem domain, I'll usually pick Python, in part because of its extensive library.

    1. Re:other factors often dominate language choice by hey! · · Score: 4, Insightful

      Well libraries. That's a huge part of language choices these days; you really choose frameworks or libraries and live with the language as a consequence. A lot of what we do these days is glue stuff together.

      This problem, however is a completely different kind of programming. It's old school stuff: building everything you need yourself to run on really slow hardware. And hardware is always slow relative to crypto problems. Ever try to implement RSA encryption from scratch? I have. There's a reason the public key stuff is only used for key exchange.

      I think the usefulness of Ada on this kind of problem is related to the issue of testing being costly. When I started in this business, compiling and linking a two hundred line program took about fifteen minutes. Something like unit testing would have been utterly impractical. So a strictly typed language was for nearly everyone a good idea.

      Over the last couple of years, I've been trying my hand at a number of difficult algorithmic problems. This is not the stuff that 99% of the programmers in the world do professionally, including me.

      Working on these problems was like programming was in the old days. Not only was it just you and the problem with no frameworks to come between, every output becomes a milestone when it takes a program days to generate. It also means that the style of programming is different. You don't worry so much about language restrictions introducing frictional losses into the code/test/recode cycle. You do worry more about mistakes that make it past the compiler.

      Ada's philosophy is that coding should be, if not exactly slower certainly more deliberate. If you are running something for which your hardware is monumentally slow, then this is a good style to work in.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  15. You couldn't BE more wrong by MosesJones · · Score: 4, Insightful

    As someone whose first programming language was Ada, and who knows of several universities around the same time who chose Ada as a teaching language, I can say with certainty that you are completely wrong.

    First off those strict rules help you because you spend miles less time debugging stuff you don't understand, once it compiles it will tend to run and the compiler gives helpful messages about what you are doing wrong (often including suggestions on how to fix it). With Java, and especially C and C++, let alone scripting languages the beginner spends much more time debugging non-operational code than writing the code in the first place. This tends to mean that these people focus on "getting an executable" rather than "getting it running".

    Ada is a brilliant language to teach newbies in (again I've personally done this) as you can explain the abstract concepts and then have the compiler make sure they are doing it right rather than have them say "it compiles but it keeps falling over, why?".

    Ada's issues are due to the mentality of lots of (IMO) unprofessional engineers who focus on the number of characters over the operational viability of a system.

    And for a final point. Take a look at the complex code the guy wrote, if that was in Java, C, C++, Scala, Ruby, Perl, LISP or what ever do you think that you'd have a chance of understanding it?

    --
    An Eye for an Eye will make the whole world blind - Gandhi
  16. Re:What are the good ones? by glop · · Score: 2, Informative

    Hi,

    The GNAT is based on GCC. It's free and it is damn good.
    I was also using AONIX and they have a free (as in beer) version. I have always preferred GNAT though.

    I am not sure about a website though...

  17. Re:What are the good ones? by DdJ · · Score: 3, Informative

    Can't give you advice on the PC, but on the Mac, the default compiler is the GNU compiler suite. That's where the C, C++, and Objective-C compilers come from.

    The GNU compiler suite also has an ADA compiler (GNAT, GNU Ada Translator). Should be possible to get it and plug it in without much trouble, and then it'd integrate with everything else. Heck, should be possible to include ADA modules into an Objective-C Cocoa application, even.

    There is also a GNU FORTRAN, worth checking out. Even today, you can't do mathematics as efficiently in C as you can in FORTRAN. (This is because of the language; in Fortran, taking the address of an existing variable isn't normal, so variables don't end up with the possibility of "aliases" that they don't know about, which means a lot more stuff can safely be done all in registers and stuff like that.)

    There is also a GNU Pascal, but unlike ADA and FORTRAN, I'm not personally aware of any reason to actually use it.

  18. Re:Programmer not langauge. by jellomizer · · Score: 4, Informative

    Well it is more complex then that. Different language syntax can help or hinder someones performance for a particular job. For example old C didn't have much to say in terms of string handling if you wanted to use a string you needed to do a Char *VarName then when working with that languge you need to insure memory managment and that you don't create buffer overflows..... A big pain if you didn't make youself some good String functions you spend a lot of your programming just making sure your program doesn't blow up. vs. Newer Languges And the String class in C++ where you can concatinate get sub strings parse.... it makes doing such job much easier and a lot less anoying. Most well programed languges will not prevent you from getting anything done. However there is the Human element of the equasion if the syntax is to difficult for a particular job then the person will tire out and make more mistakes. The winner of this competition felt that ADA syntax offered him the ability to solve the problem better, thus helped him to win.

    I have written Web Apps in FORTRAN 77 just to prove that you can. However I wouldn't say it would be OK to consult a client to do the same, as it really isn't the right tool for the job.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  19. Horses for courses by Viol8 · · Score: 4, Interesting

    Its not really surprising that he found ADA nicer to use than C for this sort of project because its not the sort of thing C was created for. People seem to think that C was designed as an all purpose programming language - it wasn't. It was specifically designed as a systems programming language that could substitute for assembler 99% of the time. Its abilities lie in low level manupulation of memory and I/O , not in high level mathematics algorithms (though obviously it can do this too).

    Then of course C++ came along which wanted to have its cake and eat it and the end result was a nasty mishmash of low and high level constructs which is difficult to learn , unintuitive and generally messy to use.

  20. HDL by Anonymous Coward · · Score: 2, Interesting

    I've used both verilog (C based) and VHDL (ADA based) and the latter wins hands down for being maintainable and easy to debug. Nobody had to write a LINT checker for VHDL like they did for verilog. I totally believe this guy.

  21. Churchill didn't order it scrapped... by Anonymous Coward · · Score: 2, Interesting

    He (and his successor, Attlee) kept it classified. Then, during decolonization, they gave lots of captured Enigma machines to former colonies to allow them to keep their communications secure -- and allow the former colonial power to keep an eye on things :)

  22. I wonder ... by kst · · Score: 2, Interesting

    I can't help wondering how many of the people making snide comments about Ada (note: not ADA; it's not an acronym) have actually used it.

  23. Re:Programmer not langauge. by Lodragandraoidh · · Score: 2, Interesting

    If I could type 90 wpm and never make a mistake, I'd be using Ada or Fortran today.

    I can't, so I don't.

    For me it is how fast I can produce what the customer/user desires that matters - and more importantly, how fast I can change it - so I use Python - with the option (as yet unneeded) to build C/C++ modules for that language for slow bits. If a bug pops out of my code, I can easily squash it; more difficult with a compiled language.

    YMMV

    --

    Lodragan Draoidh
    The more you explain it, the more I don't understand it. - Mark Twain
  24. Obvious.. by jovius · · Score: 2, Informative

    He obviously settled on Ada, because Ada allowed him to implement.

  25. Re:Horses for courses - please explain by default+luser · · Score: 2, Informative

    But in order to fall back to the post, firstly as noted, there are bit fields in C, and you can use them to represent sequences of bits in 90% of the cases where you need to.

    Ada has an equivilant with packed types. You can set the 'Size attribute on custom types with bit precision, and you can pack multiple custom types into a record just like bitfields. We use this to read in packed data from hardware all the time.

    The only major failing I found was using these for stream IO (file in/out): unless you redefine the stream attributes for the type, Ada will automatically assume that the minimum size of the type is 8 bits, and will resize fields smaller than this. Makes for a lot of fun when trying to figure out why your file format is wrong, or you read in incorrect data.

    C has bitwise operators that actually works (compared to Ada), which makes it a lot more suitable for bitmanipulation than Ada.

    Oh, hell yes. Bitwise operations in Ada are so clumsy they made me tear my hair out.

    C also treat arrays and pointers as the same, and pointers are not checked, and you can cast data and pointers to whatever you want, this is why it is suitable for low level memory manipulation.

    I don't consider treating arrays and pointers the same to be a huge benefit; it's more of a kludge. Anyway, you can get the same performance as C pointers by using Ada access types; just make sure your types are aliased.

    --

    Man is the animal that laughs.
    And occasionally whores for Karma.

  26. Re:Horses for courses - please explain by lordholm · · Score: 2, Informative

    "Ada has an equivilant with packed types. You can set the 'Size attribute on custom types with bit precision, and you can pack multiple custom types into a record just like bitfields. We use this to read in packed data from hardware all the time."

    Yes, this is true, and it is one of the areas where Ada is very nice, i.e. for doing packet decoding (though in my opinion, erlang is nicer in this aspect).

    The bad thing is that the syntax for declaring your packed records in Ada is a bit redundant.

    --
    "Civis Europaeus sum!"
  27. Re:Programmer not langauge. by gigabyteme · · Score: 2, Informative

    If I could type 90 wpm and never make a mistake, I'd be using Ada or Fortran today.
    Oh please. Once upon a time I used Ada as my primary language for several years and I simply don't understand all these "Ada is too verbose", or "Ada is too strictly typed for beginners to learn" type of comments. People making these comments have never used Ada. Ada code can be verbose and hard to read just like any other language, but most of the time good Ada code is concise and readable to the point where it's almost poetry and reads like natural language. Anyone can easily program in Ada as long as they understand data types. It is possible to code 1000s of new lines between compiles and have it compile perfectly on the first shot. I've done it and I'm definately not a "superstar programmer".