adafruit / adafruit/Adafruit_CircuitPython_ATECC

random function is not generating random numbers

Open
#21 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
20
Forks
23
PR merge metrics
No merged PRs in 30d

Description

[random](https://github.com/adafruit/Adafruit_CircuitPython_ATECC/blob/a39bdd64be6b09acc272e59241115cc0074038ff/adafruit_atecc/adafruit_atecc.py#L330) function is not generating random numbers.

For example:
```
...
print("Random Value: ", atecc.random(rnd_min=200, rnd_max=1000024))
...
```
always returns `2040`

```
...
print("Random Value: ", atecc.random(rnd_min=0, rnd_max=1024))
...
```

always returns `1016`

Tested on a RPi 3B v1.2 using 3.3v
Code used to test - https://github.com/adafruit/Adafruit_CircuitPython_ATECC/blob/master/examples/atecc_simpletest.py

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the random function in adafruit_atecc/adafruit_atecc.py at the linked line and reproduce the reported values using examples/atecc_simpletest.py on the stated hardware. Trace the random-number request and range handling; it is done when repeated calls produce varying values within the requested bounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cryptography
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.