Re: Release 1.1 (beta) of my AES implementation
From: Mok-Kong Shen (mok-kong.shen_at_t-online.de)
Date: Fri, 27 Jun 2003 01:13:59 +0200
Mok-Kong Shen wrote:
> Mok-Kong Shen wrote:
> > Bryan Olson wrote:
> > > For speed (and little space too) get rid of all the "sc"
> > > variable in aesprocess() and all the if..else's that uses it.
> > > Code two rounds in-line within the loop, and use a break to
> > > get out after an odd number of rounds (or a goto to enter
> > > between the two rounds). Also note that there's currently
> > > unreachable code after the for loop, because all possible values
> > > for Nr are even.
> > sc is a flag needed for using the alternating buffers,
> > which helps to gain some efficiency (otherwise one
> > has to do copying). The observation of your last
> > sentence is right. I leave the general case in, so that
> > one has no difficulty in experimenting with arbitrary
> > values of NR. (Also I don't have to explain what value
> > sc has before entering the last round. I had actually
> > in one stage of the developement deleted the for AES
> > standard unused branch but later re-introduced it.)
> Sorry, my answer wasn't quite complete. I don't think
> that getting rid of sc and doing in the way you suggested
> would lead to substantial improvement. (An if and an
> assignment would probably not cost too much.) I would
> think that the logic is easier to see with sc.
Addendum: I have experimented a bit and found that
your suggestion does seem to bring about certain reduction
of runtime and therefore I was wrong with my conjecture.
I'll yet have to do some work at the moment. If the result
is clear, that modification will be taken up in the full
release 1.1. Many thanks anyway for the suggestion.
M. K. Shen