News for hackers. Stuff that matters.
Re:Hans Peter Luhn and the Birth of the Hashing Algorithm by munificent on Wednesday January 31, 2018 @12:52PM (#16275822)
Hashing functions are cool and all, but let's talk about that groovy "Cocktail Oracle" he invented. It's basically a clever physical representation of bitwise arithmetic.

The oracle works with bit strings all of the same length. Each bit position represents a single cocktail.

Each ingredient card is a bit string. Each bit is 1 (opaque) if the ingredient is needed for the cocktail at that bit position.

You take all the ingredients you have and discard their bitstrings ("turn down their cards"). Then you or together the remaining bitstrings of all of the ingredients you don't have (look through their overlapping cards). In other words, not having an ingredient forbids certain cocktails. Any bit positions that remain zero (transparent all the way through to the key card on the back showing the names of the cocktails at each position) are cocktails that you have enough ingredients to make.

Using opacity to represent bitwise "or" is pretty clever. Turning down the ingredient cards you don't have is really clever. I kind of want to make one of these now.

Re:Hans Peter Luhn and the Birth of the Hashing Algorithm by theoh on Wednesday January 31, 2018 @07:38PM (#16278863)
Re:Hans Peter Luhn and the Birth of the Hashing Algorithm by Sniffnoy on Wednesday January 31, 2018 @02:59PM (#16277011)
I mean this is really about set operations; thinking of it in terms of bits and integers doesn't really add anything.
Re:Hans Peter Luhn and the Birth of the Hashing Algorithm by munificent on Wednesday January 31, 2018 @03:27PM (#16277251)
The mechanics do matter because it's fundamentally a mechanical device.
Re:Hans Peter Luhn and the Birth of the Hashing Algorithm by Sniffnoy on Wednesday January 31, 2018 @05:20PM (#16278076)
What about it involves thinking of elements as bits and sets as whole numbers? I'm not seeing it. Everything you just described is just a physical representation of sets and operations on sets. I don't see any step where elements are mapped to powers of 2 and added up (unless you for some reason insist on thinking that way of aggregating elements into a set), nor any step where a number is broken into bits (again, unless you for some reason insist on thinking that way of breaking a set into its elements).
Re:Hans Peter Luhn and the Birth of the Hashing Algorithm by munificent on Thursday February 01, 2018 @12:00PM (#16283434)
> What about it involves thinking of elements as bits and sets as whole numbers?

I said bitwise arithmetic, not binary numbers. :)

> Everything you just described is just a physical representation of sets and operations on sets.

Sure, and how is the set represented and its operations implemented? In the Oracle, each set is represented by a bitmask with a bit position for each element in the set. Set operations are implemented as bitwise operations on those bitmasks.

Re:Hans Peter Luhn and the Birth of the Hashing Algorithm by spenczar5 on Wednesday January 31, 2018 @06:13PM (#16278428)
I’m more used to bits than sets, so it worked for me. People have different backgrounds.