Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <string.h>
- #include <time.h>
- #define DLK_MAX 17
- void rand_init()
- {
- srand((unsigned int)time(NULL));
- }
- int dlk_gen(char* buffer, size_t max, char* mac)
- {
- int rs = 0, mac_hi, mac_lo;
- if (max >= DLK_MAX)
- {
- sscanf(mac, "%04x%08x", &mac_hi, &mac_lo);
- mac_lo ^= 0xdeadbeef;
- rs = sprintf(buffer, "%08x%08x", mac_lo, (rand() << 16) | rand());
- }
- return rs;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement