Skip to content

Instantly share code, notes, and snippets.

@juliusgeo
Last active February 6, 2023 02:28
Embed
What would you like to do?
n=256;q,t,m,e,p,c,f=(range(n),16,lambda x
,y, r=0:m((h:=x <<1,h^283)[
h&n!= 0],y>> 1,(r,r ^x)
[y&1])if y else r,lambda
a,w= 1,p=n -2:e(m(a, a),(w,m
(w,a))[p&1] ,p>> 1)if p
else w, lambda b: list
(map (print, ["%.2x "*t %(*b[r:r+
t],)for r in q[::t]]+[""])),lambda a,i:(a
<<i|a>>8-i)&255,lambda a:(a^c(a,1)^c(a,2)
^c(a,3)^c(a,4))^99);p(s:=[f(e(i))for i in
q]),p([*map(s.index,q)])
@juliusgeo
Copy link
Author

juliusgeo commented Jan 4, 2023

This is in code golf style, so priority is terseness. This program is only 512 bytes, which means it is the same amount of code compared to just storing a lookup table for the two boxes. More details can be found on Wikipedia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment