Last active
April 19, 2023 23:41
-
-
Save juliusgeo/969c722b2152e53e4f6bb94ca2696c7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Output: