HNHacker News
TopNewBestAskShowJobs

user2994cb

131 karma · joined April 15, 2014

submissionscomments
user2994cb··on Godbolt: Enter C, get Assembly
Seems to need -mavx2 to really go to town with 64 bit: https://godbolt.org/g/6EFYeY
user2994cb··on Godbolt: Enter C, get Assembly
Harder to vectorize 64-bit arithmetic?
user2994cb··on Fast Fibonacci Algorithms (2015)
That's nice. Here's a (recursive) Python implementation:

http://ideone.com/z1sUp4

user2994cb··on Handbook of Applied Cryptography (2001)
And Dan Boneh's Coursera course is excellent too (maybe one day he will get around to doing the endlessly postponed part 2).
user2994cb··on Handbook of Applied Cryptography (2001)
Also, section 9.6.5 advocates MAC-then-encrypt over encrypt-then-MAC - presumably the flaws in this approach have only become apparent since the book was published.

An interesting historical document though.

user2994cb··on What Do You Do with 120-Sided Dice?
As noted elsewhere, bipyramids and trapezohedra can have unlimited (even) numbers of sides - not very practical though.
user2994cb··on What Do You Do with 120-Sided Dice?
You can also use the duals of (convex) uniform polyhedra (as here) - uniform polyhedra have equivalent vertices, their duals have equivalent faces.
user2994cb··on What Do You Do with 120-Sided Dice?
If you are going to go 4 dimensional, you'll be wanting the dual of an omnitruncated 120-cell, giving a d14400:

https://en.wikipedia.org/wiki/Runcinated_120-cells

user2994cb··on An integer formula for Fibonacci numbers
Most fast methods for computing fib(n) come down to some variation of repeated squaring, so the time is dominated by the last multiplication (since the number of digits is doubling each time).
user2994cb··on An integer formula for Fibonacci numbers
Nice. A cut down version using base-10:

  X = 10**3
  print X**16//(X*X-X-1)
  # 1001002003005008013021034055089144233377610
It's like a sideways addition version of the standard Haskell lazy list version:

  fib = 0 : 1 : zipWith (+) fib (tail fib)
user2994cb··on N-queen puzzle in 4 lines of Scala
That should be "q s [] = [s]", otherwise you get 92 copies of the empty list.
user2994cb··on N-queen puzzle in 4 lines of Scala
Actually, this is better (and no less clear):

  import Data.List
  queens n = q [] [0..n-1] where
   q s [] = [[]]
   q s as = concatMap (\a -> q (a:s) (delete a as)) (filter (f 1 s) as)
   f _ [] a = True
   f n (b:s) a = a /= b+n && a /= b-n && f (n+1) s a
  main = print $ length (queens 8)
Undoubtedly functional, the question is whether it is improved eg. by using folds instead of explicit recursion, or replacing concatMap with monadic join.
user2994cb··on N-queen puzzle in 4 lines of Scala
Well, here's a fairly compact Haskell function that should be reasonably efficient (no fancy stuff mind):

  queens n = q n n [[]] where
   q 0 m ss = ss
   q n m ss = q (n-1) m (concatMap (\s->(map (:s)(filter (f 1 s) [0..m-1]))) ss)
   f _ [] a = True
   f n (b:s) a = a /= b && a /= b+n && a /= b-n && f (n+1) s a
  main = print $ queens 8
user2994cb··on The remarkable accuracy of the Trinity College clock
Nice, I haven't seen that one (I was at Churchill, which doesn't have a decent sundial AFAIK, despite Frank King being a Fellow ("Chairman of the British Sundial Society" apparently - he did the Queens' recalibration as well as that Selwyn dial).

Magdalene has a interesting modern dial too.

user2994cb··on The remarkable accuracy of the Trinity College clock
Or consider the Queens' College sundial:

http://www.queens.cam.ac.uk/life-at-queens/about-the-college...

user2994cb··on Let's code a TCP/IP stack, 1: Ethernet and ARP
In this case, it seems the ioctl call will do the null termination & in fact, the kernel itself uses strcpy for that field (presumably OK since the device structure has a null terminated name):

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux....

user2994cb··on Any smooth cubic surface contains 27 lines
http://matthewarcus.github.io/polyjs/clebsch.html
user2994cb··on What’s So Great about Continued Fractions?
Another neat application of continued fractions is Wiener's attack on RSA:

http://en.wikipedia.org/wiki/Wiener%27s_attack

user2994cb··on A Categorical Manifesto (1991) [pdf]
"Tossing Algebraic Flowers down the Great Divide":

http://cseweb.ucsd.edu/~goguen/pps/tcs97.pdf

user2994cb··on Cracking Cloudflare's heartbleed challenge
Nice. To speed things up, you could look for 128 byte malloc'ed chunks with a 16 byte header of "xx xx xx xx 90 00 00 00" or "xx xx xx xx 91 00 00 00" (for a 2048 bit modulus).

Looks to me like OpenSSL caches the modulus for Montgomery multiplication and that's where the primes in higher memory are coming from (see rsa_eay.c around line 774).

← PreviousPage 3 of 3