Nuova libreria pRNG

leo72:
...
EDIT:
vedo ora che può generare anche numeri casuali. Ok. Però pRNG non costa nulla :wink:

Si, il datasheet parla proprio di : "Internal, high-quality Random Number Generator (RNG)" ...

"Random Number Generator (RNG)
The ATSHA204 includes a high-quality random number generator that returns a 32-byte random number to the system. The device combines this generated number with a separate input number to form a nonce that is stored within the device in TempKey and may be used by subsequent commands.
The system may use this random number generator for any purpose. One common purpose would be as the input challenge to the MAC command on a separate CryptoAuthentication device. The device provides a special Random command for such purposes, which does do not affect the internally stored nonce.
To simplify system testing, prior to locking the Configuration zone the random number generator always returns the following value:
ff ff 00 00 ff ff 00 00 ...
where ff is the first byte read from the device and is used for the SHA message.
To prevent replay attacks on encrypted data that is passed to or from the ATSHA204, the device requires that a new, internally generated nonce be included as part of the encryption sequence used to protect the data being read or written. To implement this requirement, the data protection key generated by GenDig and used by the Read or Write command must use the internal random number generator during the creation of the nonce.
Random numbers are generated from a combination of the output of a hardware random number generator and an internal seed value, which is not externally accessible. The internal seed is stored in the EEPROM, and is normally updated once after every power-up or sleep/wake cycle. After the update, this seed value is retained in registers within the device that are invalidated if the device enters sleep mode or the power is removed."

... e si, costa (... anche se poco) e usa un pin :smiley: :smiley: :smiley:

Guglielmo