Library creating randomized UUIDs and MAC addresses for Earl E. Philhowers Arduino core and PicoSDK.
Here is a simple example which shows the capabilities of the library.
#include "Arduino.h"
#include "IDToolsPico.h"
void setup() {
Serial.begin(9600);
delay(2000);
}
void loop() {
uint8_t uuid[16];
generateUUID(cid);
Serial.printf("UUID %s version %d\n", printUUID(uuid), verifyUUID(uuid));
uint8_t mac[6];
generateMAC(mac);
Serial.printf("MAC %s\n", printMAC(mac));
delay(1000);
}Generate a random 128bit UUID version 4
void generateUUID(uint8_t uuid[]);
uint8_t* generateUUID();The results is stored in a 16 bytes wide uint8_t array
Example
uint8_t uuid[16];
generateUUID(uuid);Verify for version
uint8_t verifyUUID(uint8_t uuid[])Returns the version (1 - 7) or 0 if the UUID is not correct
Example
uint8_t version = verifyUUID(uuid);Generate a formated string of the UUID
void printUUID(uint8_t uuid[], char uuidString[])
char* printUUID(uint8_t cid[])The returned string size has 36(37) chars and is formated as FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
Example
Serial.println(printUUID(uuid));Generate a random MAC address for local use
void generateMAC(uint8_t mac[]);
uint8_t* generateMAC();The result is stored in a 6 bytes wide uint8_t array
Example
uint8_t mac[6];
generateMAC(mac);Generate a formated string of the MAC address
void printMAC(uint8_t mac[], char macString[])
char* printMAC(uint8_t mac[])The returned string size has 17(18) chars and is formated as FF:FF:FF:FF:FF:FF
Example
Serial.println(printMAC(mac));