For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <sys/time.h> | |
| #include <sys/resource.h> | |
| double get_time() | |
| { | |
| struct timeval t; | |
| struct timezone tzp; | |
| gettimeofday(&t, &tzp); |
| local random = math.random | |
| local function uuid() | |
| local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' | |
| return string.gsub(template, '[xy]', function (c) | |
| local v = (c == 'x') and random(0, 0xf) or random(8, 0xb) | |
| return string.format('%x', v) | |
| end) | |
| end |
| -- | |
| -- Reverses an ipairs table | |
| -- | |
| --local r = ReverseTable({'a', 'b', 'c'}) | |
| --for k, v in ipairs(r) do | |
| -- print(k, v) | |
| --end | |
| -- | |
| -- | |
| function ReverseTable(t) |