It's actually expressed as a set of complex numbers with lots of data in the imaginary side. These are displayed with fixed point decimals (or static point decimals) expressing a width and height for the rectangle hence the term S-Box. Since DES works on 64 bit blocks using a 56 bit key, you can use either 56 decimal places, or 64 for more accuracy, but far less speed. For purposes of optimization to extreme high speed, you should take your key and sort it (be sure to use Quick Sort here, and not bubble sort!), that is put all the 1 bits to the right, all the 0 bits to the left, and the naughty bits in your head. Then take the result and express it as 2^X-1, and extract X. Once you have X, repeat the process until X=2. With me so far? Good, now you have to extract the naughty bits from your mind, and let N express them. Your S boxes are now comprised of X+Ni which you can simply express as 2+Ni. Now, if you recall, Ni is the symbol for nickel, which is what this algorithm is worth $2.05 payable in Monopoly dollars. If you've been following the news, you'll know that Microsoft is a monopoly and therefore weighs the same as a duck. Since ducks float, and wood also floats, ducks must weigh the same as wood, and therefore are witches. Multiply this by the flight speed of an unladen African swallow, and divide it by the flight speed of a laden european swallow, then add your favorite color, and substract your name. Okay, so that's the high-speed write implementation, don't forget that the high speed read implementation is the opposite of the write, so reverse the sort and this time, make sure you use random sort. (That is toss the bits up randomly, and if they wind up in the order you wanted, you're done, otherwise keep tossing.) And don't forget that tossed bits require Ranch dressing or Italian, with onion crutons, but never Russian (because the USSR never used DES.) Now that we've told you the secret of high speed DES, your assignment is to come back in a week with source code to the above written in SNOBOL which can run on CP/M 6502 machines. Of course you'll need to roll your own CP/M 6502 OS as well as a SNOBOL compiler and assembler, but heck, that's easy. Oh, one catch, make sure your CP/M runs on all C64 and Apple II's, or you can't properly consider it a portable DES implementation. Good luck. [ Snicker, snicker, ROTFLMAO! I wonder how long it will take him to figgure out that he's being trolled... heh... ] Nobuki Nakatuji wrote:
When write high-speed implementation, Is S-box written by hexadecimal or written by decimal? Thanks.
-- =====================================Kaos=Keraunos=Kybernetos============== .+.^.+.| Ray Arachelian |Prying open my 3rd eye. So good to see |./|\. ..\|/..|sunder@sundernet.com|you once again. I thought you were |/\|/\ <--*-->| ------------------ |hiding, and you thought that I had run |\/|\/ ../|\..| "A toast to Odin, |away chasing the tail of dogma. I opened|.\|/. .+.v.+.|God of screwdrivers"|my eye and there we were.... |..... ======================= http://www.sundernet.com ==========================