randombytes icon indicating copy to clipboard operation
randombytes copied to clipboard

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

Open Aric3 opened this issue 1 year ago • 2 comments

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

Aric3 avatar Jun 03 '23 09:06 Aric3

@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?

dsprenkels avatar Jun 06 '23 08:06 dsprenkels

@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.

Aric3 avatar Jul 27 '23 08:07 Aric3