Differences From
Artifact [c79e9ffb10]:
24 24 &hash[0])
25 25 ptr = ptr + lib.math.shorthand.gen(lib.math.truncate64(hash, [hash.type.N]), ptr)
26 26 return ptr - out
27 27 end
28 28
29 -terra m.cookie_interpret(secret: lib.mem.ptr(int8), c: lib.mem.ptr(int8), now: uint64) -- returns either 0,0 or a valid {authid, timepoint}
30 - var authid_sz = lib.str.cspan(c.ptr, lib.str.lit '.', c.ct)
29 +terra m.cookie_interpret(secret: lib.mem.ptr(int8), c: lib.mem.ptr(int8), now: uint64)
30 + -- returns either 0,0 or a valid {authid, timepoint}
31 + var authid_sz = lib.str.cspan(c.ptr, '.', c.ct)
31 32 if authid_sz == 0 then return 0,0 end
32 33 if authid_sz + 1 > c.ct then return 0,0 end
33 - var time_sz = lib.str.cspan(c.ptr+authid_sz+1, lib.str.lit '.', c.ct - (authid_sz+1))
34 + var time_sz = lib.str.cspan(c.ptr+authid_sz+1, '.', c.ct - (authid_sz+1))
34 35 if time_sz == 0 then return 0,0 end
35 36 if (authid_sz + time_sz + 2) > c.ct then return 0,0 end
36 37 var hash_sz = c.ct - (authid_sz + time_sz + 2)
37 38
38 39 var knownhash: uint8[lib.crypt.algsz.sha256]