Hacker Newsnew | past | comments | ask | show | jobs | submit | teo_zero's commentslogin

Sorry, I've read and reread TFA but the concept still evades me. Is it that, since it's easier for a hash function to have higher entropy in the higher bits than in the lower ones, it would be more logical for hash tables to discard the lower bits and keep the higher ones?

Higher entropy in the higher bits is a property of addition and multiplication when the result has the same size as the operands (i.e. the result is taken modulo 2^N, which folds back the values exceeding the size of the result).

When other operations are used, there may be other bits with higher entropy. For example, when full-length multiplication is used (i.e. where the length of the result is the sum of the lengths of the operands), the middle bits have the highest entropy, not the top bits. On CPUs like the Intel/AMD x86-64 CPUs, where fast long multiplication instructions are available, this can be exploited in more performant hash functions and PRNGs.

In hash functions, additions and multiplications are frequently used together with rotations, in order to redistribute the entropy from the top bits to the bottom bits, during the following operations.


Honorary mention: byte swapping instructions (originally added to CPUs for endianness conversion) can also be used to redistribute entropy, but they're slightly slower than rotations on Intel, which is why I think they aren't utilized much.

Yes, that's my point. It's not true that all hash functions have this characteristic, but most fast ones do. (And if you're using a slow-and-high-quality hash function, the distinction doesn't matter, so might as well use top bits.)

While I generally like to reinvent the wheel, for hash functions I strongly recommend to use a proved good one. Djb2 by the venerable Daniel Bernstein satisfies all the requirements of TFA.

  h = 5381
  while still has data:
    h = h * 33 + next_byte()
  return h
PS of course if you think the multiplication is overkill, consider that it is nothing more than a shift and an addition.

Djb2 is hardly a proven good hash :) It's really easy to find collisions for it, and it's not seeded, so you're kind of screwed regardless. It's the odd middle ground between "safely usable in practice" and "fast in practice", which turns out to be "neither safe nor fast" in this case.

So, do you see now the assumptions baked in your argument?

> when you need to support larger deployments

> shipping

> passing it off to someone else


> Canonical isn’t making 6GB memory a hard requirement for Ubuntu 26.04. It will still install on machines that fall below the minimum requirement, but users will have to deal with slower performance.

I think we have quite different definition of "minimum requirement", then.


I think the author is too quick to dismiss the impact of the plugboard.

> IC attacks only the rotor settings [...] Once you’ve found the right rotors and positions, you can solve the plugboard separately using frequency analysis.

So two steps: first solve for rotor settings with IC analysis, then solve the plugboard.

But IC analysis can't find the solution, just propose a lot of candidates among which a human can spot the correct one by looking for intelligible German text. And how can you spot intelligible German text if some letters are swapped by the plugboard?


Yeah something is wrong there, and I don't see actual breaks in the post, though maybe I missed something. Solving the rotors to get to the plugboard isn't so easy! The permutation changes every character, as the rotors advance.

The choice of countries seems arbitrary. I thought the list was limited to EU nations, but Iceland and Norway are there. Then I thought it was EFTA countries, but Switzerland is missing. Then noted Belgium is also missing... I give up!

Saying that IPv4 is ok because we have NAT and CGNAT is like saying that spam is not a problem because we have spam filters everywhere.

I can't help wondering how the 413,793 bars were stacked.

413,793 is 3×3×23×1999.


It wasn't actually that exact amount. It was "about 12 tons", and somebody did the 12000 kg / 29g calculation and used the answer with way too many significant digits. Probably the reporter trying to make the 12 ton number relatable.

(You might object that KitKats usually weigh 40g. So these were probably the new KitKat Icon F1 chocolates, which weigh exactly 29g.)


My brain went here too. I'm guessing that one box missed the truck (either it was damaged during loading or had a manufacturing defect), so a full shipment is 3 x 3 x 23 x 2000. So my SWAG:

1 box = 3 x 3 x 23 bars

1 pallet = 10 x 10 boxes

1 truck = 20 pallets


How did they come up with an odd number when individual packs are an even number of bars? (And, I imagine, cartons are a multiple of dozens of packs.)


> it is legal to optimize out any code paths that rely on this, even if they occur earlier in program order.

I don't think this is true. The compiler cannot remove or reorder instructions that have a visible effect.

  if (p == 0)
    printf("Ready?\n");
  *p++;
The printf() can't be omitted.


> The compiler cannot remove or reorder instructions that have a visible effect.

You might be surprised! When it comes to UB compilers can and do reorder/eliminate instructions with side effects, resulting in "time travel" [0].

IIRC the upcoming version of the C standard bans this behavior, but the C++ standard still allows it (for now, at least).

[0]: https://devblogs.microsoft.com/oldnewthing/20140627-00/?p=63...


No, this is explicitly legal. Most compilers will shy away from it these days since it made a lot of people upset, but it's definitely allowed.


Why would power flowing out of my house into the grid be a theft?


The kind of meters we used to install 50 years ago would turn backwards if electricity flowed backwards.

So if you spent a week with the meter connected normally, then you swapped the input and output cables around for a week, the meter would be back at zero. Free electricity!

They used anti-tamper seals to make it more detectable, but there are ways around that sort of thing.


I assume the scam would be you rewire the breaker so the grid is on the apparent load side. It's not exactly hard to do, just dangerous.


Maybe it looks like you're trying to trick the meter into running backwards?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: