The random number problem was solved... Thank you for all the support.. I
solved it using the external file ("/dev/urandom") method specified by
Markus..

Thank you so much sir...

Regards,

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


On 11 July 2014 06:38, <[email protected]> wrote:

> Send Tinyos-help mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
> or, via email, send a message with subject or body 'help' to
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tinyos-help digest..."
>
>
> Today's Topics:
>
>    1. Re: random number (Markus Becker)
>    2. Re: SHA1 error in TOSSIM (Jisha Mary Jose)
>    3. Re: SHA1 error in TOSSIM (Johny Mattsson)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 10 Jul 2014 20:59:57 +0200
> From: Markus Becker <[email protected]>
> Subject: Re: [Tinyos-help] random number
> To: Michiel Konstapel <[email protected]>
> Cc: Jisha Mary Jose <[email protected]>,  Tinyos-Help
>         <[email protected]>
> Message-ID:
>         <CAFvB54a_srbZwZ0m_Kvmd-poX8Y6EY1fERAuBLM15Skcko=
> [email protected]>
> Content-Type: text/plain; charset="utf-8"
>
> I have been seeding TOSSIM from outside (/dev/urandom) with code like this:
>
> #include <stdio.h>
> ...
>
>   uses interface ParameterInit<uint16_t> as Seed;
>
> ...
>
>   event void Boot.booted() {
>     uint16_t seed;
>     FILE *f;
>
>     f = fopen("/dev/urandom", "r");
>     fread(&seed, sizeof(seed), 1, f);
>     fclose(f);
>
>     call Seed.init(seed+TOS_NODE_ID+1);
> }
>
> Markus
>
>
> On Thu, Jul 10, 2014 at 4:44 PM, Michiel Konstapel <[email protected]>
> wrote:
>
> >  Probably not ? I bet it compiles the same RandomC as it does for a real
> > node, so it still seeds based on TOS_NODE_ID. I have no idea if you can
> > access ?outside? sources of randomness from a TOSSIM node.
> >
> >
> >
> > *From:* [email protected] [mailto:
> > [email protected]] *On Behalf Of *Michiel
> > Konstapel
> > *Sent:* Thursday, July 10, 2014 16:17
> > *To:* Jisha Mary Jose
> > *Cc:* Tinyos-Help
> >
> > *Subject:* Re: [Tinyos-help] random number
> >
> >
> >
> > Hi! Please keep replies on the list, so others can contribute/benefit,
> too.
> >
> >
> >
> > I?m not familiar with TOSSIM, so I just googled ?TOSSIM random seed? and
> > looks like you can initialize its random number generator:
> >
> http://tinyos-help.10906.n7.nabble.com/Reproducible-TOSSIM-simulations-td16341.html
> .
> > This person has the opposite problem, trying to get reproducible run.
> >
> >
> >
> > However, I don?t know if the Tossim seed is used by the random number
> > generator.
> >
> >
> >
> > *From:* Jisha Mary Jose [mailto:[email protected]
> > <[email protected]>]
> > *Sent:* Thursday, July 10, 2014 12:16
> > *To:* Michiel Konstapel
> > *Subject:* Re: [Tinyos-help] random number
> >
> >
> >
> > Hi,
> >
> > Thankyou for the response. I am working in TOSSIM, so there are no real
> > motes. What is any other option to generate random numbers? Please guide
> > me..
> >
> >
> >   Regards,
> >
> > Jisha Mary Jose
> > ......jMj......
> >
> >
> >
> > On 10 July 2014 15:21, Michiel Konstapel <[email protected]> wrote:
> >
> > Timer.getNow() starts over at zero after every boot, so you?re probably
> > using the same seed every time unless something during the boot process
> > takes a variable amount of time (and on an embedded system or in the
> > simulator, it probably takes the same amount of time, every time ? at
> least
> > down to the millisecond level).
> >
> > Michiel
> >
> >
> >
> > *From:* [email protected] [mailto:
> > [email protected]] *On Behalf Of *Jisha Mary
> > Jose
> > *Sent:* Thursday, July 10, 2014 11:18
> > *To:* Eric Decker
> > *Cc:* Tinyos Help Request; Tinyos-Help
> > *Subject:* Re: [Tinyos-help] random number
> >
> >
> >
> > I did that, i changed the seed. But still same numbers are generated
> again
> > and again at a particular node.
> >
> >
> >   Regards,
> >
> > Jisha Mary Jose
> > ......jMj......
> >
> >
> >
> > On 10 July 2014 13:05, Eric Decker <[email protected]> wrote:
> >
> >
> >
> > asked and answered.
> >
> >
> >
> > The random number generator is pseudo-random.
> >
> >
> >
> > It starts up using a SEED which you need to modify to get different
> > sequences.
> >
> >
> >
> >
> >
> > On Wed, Jul 9, 2014 at 11:52 PM, Jisha Mary Jose <
> [email protected]>
> > wrote:
> >
> >    Hi,
> >
> > I have to generate random number for a node to use in key generation. But
> > i always get the same random number. So ichanged seed value using the
> > current system time as shown below.
> >
> >
> > module SecurityC{
> >
> >     uses interface Boot;
> >     uses interface Random;
> >     uses interface ParameterInit<uint16_t> as SeedInit;
> >     uses interface Timer<TMilli>;
> > }
> >
> > implementation{
> >
> >     uint32_t rand1;
> >     uint32_t t;
> >
> >     event void Timer.fired() {
> >
> >          t=call Timer.getNow();
> >         dbg("Boot", "%s Current time: %d \n", sim_time_string(), t);
> >     }
> >
> >     event void Boot.booted()
> >     {
> >
> >         dbg("Boot", "Application booted.\n");
> >         t=call Timer.getNow();
> >         call SeedInit.init(t);
> >
> >         rand1 = (call Random.rand32()%10)+7;
> >
> >         dbg("Boot", "%s Random number 1: %d \n", sim_time_string(),
> rand1);
> >
> >     }
> > }
> >
> > But still i am getting the same number always. How to solve this?
> >
> > Regards,
> >
> > Jisha Mary Jose
> > ......jMj......
> >
> >
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
> >
> >
> >
> >
> > --
> > Eric B. Decker
> > Senior (over 50 :-) Researcher
> >
> >
> >
> >
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20140710/500dfe23/attachment-0001.htm
>
> ------------------------------
>
> Message: 2
> Date: Fri, 11 Jul 2014 06:14:53 +0530
> From: Jisha Mary Jose <[email protected]>
> Subject: Re: [Tinyos-help] SHA1 error in TOSSIM
> To: Christian Haas <[email protected]>,    Tinyos-Help
>         <[email protected]>,  Tinyos Help Request
>         <[email protected]>
> Message-ID:
>         <
> cadnvx9oueqfmwz_-z0cygrwkcq5b-7s-e+cmjpnrov5swc7...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> #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
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20140711/ba99b453/attachment-0001.htm
>
> ------------------------------
>
> Message: 3
> Date: Fri, 11 Jul 2014 11:08:03 +1000
> From: Johny Mattsson <[email protected]>
> Subject: Re: [Tinyos-help] SHA1 error in TOSSIM
> To: Jisha Mary Jose <[email protected]>
> Cc: Tinyos-Help <[email protected]>
> Message-ID:
>         <
> cactyeanejx4ynofv9vavqmrwv61d66jc5xzi5oodpsxpa6k...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On 11 July 2014 10:44, Jisha Mary Jose <[email protected]> wrote:
>
> > void hash(){
> >
> > uint8_t x=123;
> >
> > call SHA1.context(context);
> >
>
> I don''t see where 'context' comes from. I'll have to assume it's defined
> somewhere.
>
>
>
> > call SHA1.update(context, x, sizeof(x));
> >
>
> That should almost certainly be &x rather than x. It looks like you're
> treating the value 123 as a pointer, which would explain why you're getting
> different values all the time...
>
>
>
> > call SHA1.digest(context, Message_Digest[SHA1HashSize]);
> >
>
> Again, I don't know where Message_Digest comes from.
>
>
>
> Cheers,
> /Johny
> --
> Johny Mattsson
> Senior Software Engineer
>
> DiUS Computing Pty. Ltd.
>
> *where ideas are engineered *
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20140711/d4025db8/attachment.htm
>
> ------------------------------
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
> End of Tinyos-help Digest, Vol 135, Issue 12
> ********************************************
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to