dsprenkels / randombytes

A portable C library for generating cypto-secure random bytes
MIT License
96 stars 37 forks source link

how to generate reliable randombytes on MCU or when i don't have an operating system #45

Open Aric3 opened 1 year ago

Aric3 commented 1 year ago

I want to use this code on a microcontroller, we know that a microcontroller does not have an operating system, so how to generate excellent random bytes, is there a solution thank you

dsprenkels commented 1 year ago

@Allin-Chen Heya thanks for your question. The answer really depends on the chip. There are multiple options. The best option would be to see if your chip has a TRNG implemented in hardware.

What kind of chip are you using?

Aric3 commented 1 year ago

@Allin-Chen Heya thanks for your question. The answer really depends on the chip. There are multiple options. The best option would be to see if your chip has a TRNG implemented in hardware.

What kind of chip are you using?

I'm very happy to get your reply and would like to express my sincere thanks. I'm using STM32 series, exactly, STM32F103ZET6, I have searched a lot of infomation about this chip, unfortunately, this series doesn't have a TRANG hardware. As an alternative, I'm using the clock as the seed to generate random numbers. But I'm thinking about that this maybe not a long -term solution because those random numbers may have a poor quality.