-- My Hunt Proof: a starter app for Squeeze Badge Hunt, level 7. -- 1. Change NONCE to the 4 characters the Hunt shows you (level 7 or GUIDE). -- 2. Change "id" in app.json to your own (e.g. maya-hunt-proof). -- 3. Run it on your badge, press SELECT, then go back to the Hunt: CHECK MY PROOF. -- Make it yours: change the colours, the text, add LEDs. The Hunt only checks the item. local NONCE = "0000" -- TODO: your nonce from the Hunt -- FNV-1a, 32 bits, as 8 lowercase hex characters (works on the badge's 32-bit ints) local function fnv(s) local h = 0x811C9DC5 for i = 1, #s do h = (h ~ s:byte(i)) & 0xFFFFFFFF h = (h * 16777619) & 0xFFFFFFFF end return string.format("%08x", h & 0xFFFFFFFF) end local id = badge.id() local code = fnv(id .. "|" .. NONCE .. "|squeeze") ui.bg(0x15110A) ui.label(10, 10, "MY HUNT PROOF", { size = 20, color = 0xFFE14A }) ui.label(10, 44, "Badge " .. id .. " nonce " .. NONCE, { size = 14 }) ui.label(10, 66, "Code " .. code, { size = 14 }) local status = ui.label(10, 100, "SELECT saves the proof item", { size = 14, color = 0xFFE14A }) ui.hint("SELECT save proof CANCEL exit") local busy = false function on_key(k) if k ~= "select" then return false end if busy then return true end if NONCE == "0000" then status:text("Put your nonce in NONCE first") return true end busy = true status:text("Saving...") items.grant("squeeze-hunt-proof", "Hunt builder proof", { b = id, n = NONCE, c = code }, function(ok, res) busy = false if ok then status:text("Saved! Open the Hunt: CHECK MY PROOF") if led then led.fill(255, 225, 74) end else status:text("Not saved: " .. tostring(res)) end end) return true end