#include "sha1.h"

module DisseminationC {
  uses {
            interface SHA1;
}
implementation{

void hash(){

uint8_t x=123;

call SHA1.context(context);
call SHA1.update(context, x, sizeof(x));
call SHA1.digest(context, Message_Digest[SHA1HashSize]);

dbg("All", "%s Hash is : %d \n", sim_time_string(), Message_Digest);
}

Here the three functions called are defined in TinyECC-2.0 in SHA1.nc.

This always returns different results for the same input say "123". Am I
doing it the correct way?

Please help me..



Regards,

Jisha Mary Jose
......jMj......


On 10 July 2014 16:08, Christian Haas <[email protected]> wrote:

> On 07/10/2014 12:22 PM, Jisha Mary Jose wrote:
> > Hi,
> >
> > I am using TinyOS-2.1.2 and to achieve security techniques i am using
> > TinyECC-2.0. I want to use the SHA1 available in tinyecc. But,
> >
> > When i take the hash of a value say,
> >
> > uint8_t data=123;
> >
> > I use the three functions of sha given in SHA1.nc namely, SHA1.reset,
> > SHA1.update and SHA1.digest to obtain the result. But each time i run the
> > code ie. do "make micaz sim" I get different hash results for the same
> data.
> >
> > How to get a unique hash value for each data taken? Please help me...
>
> Post the code please.
>
>
> --
> Karlsruher Institut für Technologie (KIT) - Institut für Telematik
>
> Dr. Christian Haas
> Wissenschaftlicher Mitarbeiter
> Zirkel 2 / 76131 Karlsruhe
>
> Telefon: +49 721 608-46415
> Fax:     +49 721 608-46789
> E-Mail:  [email protected]
> WWW:     http://telematics.tm.kit.edu/staff_78.php
>
> http://www.kit.edu/
> KIT - Universität des Landes Baden-Württemberg und nationales
> Großforschungszentrum in der Helmholtz-Gemeinschaft
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to