# Diffie-Hellman Key Exchange

Today we’re going to be talking about cryptography, specifically Diffie-Hellman key exchange1. The basic idea isn’t necessarily to communicate in secret, but rather to establish the information that makes doing so much easier.

# Authorship attribution: Part 3

So far, we’ve had three different ideas for figuring out the author of an unknown paper (top n word ordering in Part 1 and stop word frequency / 4-grams in Part 2). Here’s something interesting though from the comments on the Programming Praxis post:

Globules said July 19, 2013 at 12:29 PM Patrick Juola has a guest post on Language Log describing the approach he took.

# Authorship attribution: Part 2

Last time, we used word rank to try to figure out who could possibly have written Cuckoo’s calling. It didn’t work out so well, but we at least have a nice framework in place. So perhaps we can try a few more ways of turning entire novels into a few numbers.

# Authorship attribution: Part 1

About two weeks ago, the new crime fiction novel Cuckoo’s Calling was revealed to have actually been written by J.K. Rowling under the pseudonym Robert Galbraith. What’s interesting is exactly how they came to that conclusion. Here’s a quote from Time magazine (via Programming Praxis):

# A programming puzzle: f(f(n)) = -n

Two Programming Praxis puzzles in a week? Madness! Let’s do it!

This time, the puzzle at first seems rather minimal:

Write a function f so that f(f(n)) = -n for all integers n.

If you haven’t seen this problem before, take a moment to think though it. It’s a neat little problem–a close cousin to a lateral thinking puzzle.

# Perlin and simplex noise in Racket

Many games need noise. No, not that noisethis noise. Or better yet, this noise. More seriously, noise in this context refers to psuedo-randomly generated images that can be used for natural looking terrain generation1. Something like this:

# Approximating Pi with Buffon's Needle

I’m a bit late for Pi Day, but Programming Praxis had a neat problem on Friday that I wanted to check out:

Suppose we have a floor made of parallel strips of wood, each the same width, and we drop a needle onto the floor. What is the probability that the needle will lie across a line between two strips?

# Triangle Trilemma

Four points, a square?) and comes originally from a Google Code Jam problem. The problem is stated simply enough

Accept three points as input, determine if they form a triangle, and, if they do, classify it at equilateral (all three sides the same), isoceles (two sides the same, the other different), or scalene (all three sides different), and also classify it as acute (all three angles less than 90 degrees), obtuse (one angle greater than 90 degrees) or right (one angle equal 90 degrees).

But once you start implementing it, that’s when things get more interesting. 😄