[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] RC5, last test



On Mon, Apr 15, 2002 at 05:46:09AM +0200, cedric wrote:
> Hi every body,
> 
> 	I am currently finalising my code for the RC5 DNETC core, but I have a 
> problem. At the end of the process I must test every chunck of two register 
> to know if I have found the solution.
> 
> 	The solution is easy if I know the number of the chunk, and not their size. 
> Because during all the process I only use 32 bits chunks. So I know that 
> every chunk has been computed well, but I don't know how to test each chunck 
> and return the number of the chunck (to determine the key that decrypt the 
> message).
> 
> 	So my question is easy ;-) How can I do a test on each chunk to find the
> one that is null ?

For a quick test whether *any* of the chunks of <register> is zero, use
one of these:

	scmple.32 r0, <register>, r1
	scmpli.32 $1, <register>, r1

After that, you can use lsb1/msb1 to find the first/last chunk.
Another option is to tear the chunks apart and test them separately,
e.g. via and, mix/expand or shift instructions, whatever fits your needs.

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/