March 25, 2009

High level languages (don't) byte

My primary development language is Java, which is a pretty good high level language, in that it offers lots of useful features and expansive libraries even if it does take some of the finer control out of your hands.  It's even got some very handy libraries for arbitrarily-large integer and floating point math (i.e. BigInteger and BigDecimal).  All of that put together makes it a pretty handy language for doing math type stuff.

... or so you'd think.  Java lacks one crucial element for doing serious math/crypto work directly: the unsigned byte.  The thing java calls a byte contains signed values in the range from -128 to 127.  This is an amazingly frustrating thing to discover in the midst of attempting to implement any algorithm that requires real bit twiddling.  You can still do it, but you constantly have to work around the fact that you're working with a signed byte, and the fact that Java will refuse to assign it a value like 0xff.  The frustrating thing is that it wouldn't have been hard to add an unsigned byte to Java as a primitive type, but for some reason the Sun guys thought they could do without.  I managed do implement RSA in Java well enough, but I tired rather quickly of trying to do AES with it, and ended up going to MatLab.

Yeah, I know, copout on my part.  It was a class assignment, though, and the language chosen didn't matter, only that the steps were illustrated, and finding MatLab code for AES was trivial.  Next time, though, I'm ready.
more...

Posted by: leoncaruthers at 08:33 AM | No Comments | Add Comment
Post contains 1197 words, total size 10 kb.

<< Page 1 of 1 >>
11kb generated in CPU 0.0102, elapsed 0.0426 seconds.
54 queries taking 0.0356 seconds, 97 records returned.
Powered by Minx 1.1.6c-pink.