This works for me on mica2:
void func()
{
uint8_t key1[10] = "1234543253"; uint8_t key2[10] = "1234543323";
int i ;
uint8_t result[10];
for(i = 0; i < 10; i++)
result[i] = key1[i] ^ key2[i];
}
You did name key1,2 differently (k1, k2) in your code snippet
but that should have given a syntax error....
Better start looking someplace else for the actual problem.
MS
Igor wrote:
> Hi guys, what's up?
>
> Yesterday I was trying to build up a simple encription algorithm that
> takes a key and a message and do the xor operation bitwise. The problem
> is i am new in Tinyos and in c programming as well. So, let me try to
> explain better.
>
> I have two keys, k1 and k2 declared like this: uint8_t key1[10] =
> "1234543253"; uint8_t key2[10] = "1234543323"
> I need to distribute those keys btween the motes and to do that in a
> secure way i need to do the xor between k1 e k2. So i did like this
>
> int i ;
> uint8_t result[10];
> for(i = 0; i < 10; i++)
> result[i] = k1[i] ^ k2[i];
>
> I don't know what is wrong with this algorithm, but the compiler have
> returned the following error: invalid value in assignment.
>
> I don't know what to do to solve this problem, i have already googled
> but i am still lost here.
>
> Thanks for your help.
>
> Igor
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help