AN3922| Application Note

AN3922 PDF

AN3922| Application Note


Maxim/Dallas > App Notes > BATTERY MANAGEMENT Keywords: DS2790, DS2792, Random Number Generator, RNG

Sep 14, 2006

APPLICATION NOTE 3922

Generating a Random Number with the DS2790
Abstract: This application note describes how to use the lowest 4 bits of the DS2790's temperature register to generate a 16-bit random value. This note also provides example C code for generating a 16-bit random value.

Introduction
Random numbers are used in many encryption and authentication schemes. Generation of a random number involves finding a random behavior and using this behavior to generate a random value. Consequently, generating a random number with a microcontroller can be a difficult task, as microcontrollers frequently exhibit repetitive behavior. Fortunately, the DS2790 allows designers to use the lowest 4 bits of the temperature register to generate a 16-bit random value. Although only the highest 11 bits of the temperature register are defined as temperature information in the Data Sheet, all 16 bits are reported. This functionality, along with the fact that the lowest 4 bits of the register are highly random, makes them ideal for generating a 16-bit random value.

Is the Extended Temperature Data Random?
Table 1 was taken by submersing a DS2790 in a controlled temperature bath. Placing the part in such a tightly controlled temperature environment quickly exposes nonrandom temperature values. The data below shows the lowest 4 bits of the address in memory where temperature is stored. Table 1. Extended Temperature Data for the DS2790 Value Count Delta-Counts Delta-Avg 0 1 2 3 4 5 6 7 8 9 A B C D E F Total Counts: 23657 23822 24422 24091 24222 23994 24218 24258 24612 23984 23974 24005 24178 24066 23954 24313 385770 -453.625 -288.625 311.375 -19.625 111.375 -116.625 107.375 147.375 501.375 -126.625 -136.625 -105.625 67.375 -44.625 -156.625 202.375 -1.8814% -1.1971% 1.2914% -0.0814% 0.4619% -0.4837% 0.4453% 0.6112% 2.0795% -0.5252% -0.5667% -0.4381% 0.2794% -0.1851% -0.6496% 0.8394%

1/16th of Total: 24110.625 The Value column shows the value of the lowest 4 bits of the temperature register in hexadecimal. The Count column shows the number of times each value occurred in approximately 24 hours. In a perfectly random system, given infinite time to monitor the DS2790's behavior, we would see each value occur 1/16th of the time. The Delta-Counts column shows the absolute error in the number of times each value occurred compared to the ideal 1/16th value. The Delta-Avg column shows the same error as a percentage of the ideal 1/16th value--that is, the percentage difference between the ideal random behavior and the value occurring 1/16th of the time. The very low percentage values demonstrate that the lowest 4 bits of the temperature register are highly random.


AN3922 Application Note maxim Download PDF

Add this permalink to your bookmarks for future download of AN3922 ApplicationNote

Permalink: http://application.emcelettronica.com/maxim/AN3922

PDF AN3922 APPLICATION NOTE