Skip to content
Snippets Groups Projects
Commit 6d5e23a8 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

There's a bug in this test where it's calculating a digestfor the nil...

There's a bug in this test where it's calculating a digestfor the nil preimage. This is caused by using `.Sum` with a byte slice, which one might think includes that slice in the hash, but in fact only appends to that slice.

This is a regular mistake, and the situation becomes incredibly confusing when you look at the blake2b implemenation which has `.Sum` functions that work the way one might expect. Since it is becoming a checklist item, I think that qualifies `.Sum` as at least confusing and needing specific rules (imo it should be deprecated as well, its fine at first glance but seems sloppy in practice given how often devs mess it up).

Moving forward, `.Sum(nil)` is the only acceptable usage and anything else should be changed unless there's a very defensible reason AND a comment explaining why it is the way it is.
parent 551c01f4
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment