Hardware RNG on embedded devices is often weak, predictable, or non-existent. RaaS provides cryptographically secure randomness via a simple API call.
Start Free →IoT devices face unique challenges when it comes to generating secure random numbers:
Many microcontrollers lack dedicated hardware RNG. Software PRNGs seeded from predictable sources (boot time, MAC address) are vulnerable.
Embedded systems have fewer entropy sources than desktops. No keyboard, mouse, or disk activity means less randomness to harvest.
Devices often need random numbers immediately at boot, before the entropy pool has accumulated enough randomness.
Devices flashed with identical firmware may start with identical RNG states, making them predictable in aggregate.
Instead of relying on weak local entropy, fetch cryptographically secure random bytes from RaaS. Our servers use hardware RNG and maintain deep entropy pools.
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
const char* API_KEY = "raas_your_api_key";
bool getSecureRandomBytes(uint8_t* buffer, size_t length) {
HTTPClient http;
String url = "https://www.getrandm.com/api/bytes?length=" + String(length);
http.begin(url);
http.addHeader("X-API-Key", API_KEY);
int httpCode = http.GET();
if (httpCode == 200) {
DynamicJsonDocument doc(1024);
deserializeJson(doc, http.getString());
// Decode base64 bytes from response
// Copy to buffer
return true;
}
return false;
}
void setup() {
uint8_t sessionKey[32];
if (getSecureRandomBytes(sessionKey, 32)) {
// Use cryptographically secure session key
}
}
Generate secure tokens for device-to-cloud auth
Create session keys for secure communication
Randomize sampling intervals to prevent pattern analysis
Generate secure pairing codes and access tokens
Get 20 free API calls per day. Upgrade for high-volume deployments.
Create Free Account →