January 27, 2024
https://issues.dlang.org/show_bug.cgi?id=24358

          Issue ID: 24358
           Summary: std.digest on array of arrays surprisingly shallow
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody@puremagic.com
          Reporter: schveiguy@gmail.com

std.digest when run on an array of arrays uses a blunt cast to ubyte[], which means it digests the pointer/lengths, not the contents of the subarrays.

This can be surprising, and in some cases, leave a time bomb for future uses, because strings are interned.

For example:

`assert (md5Of(["hello", "world"]) == md5Of(["hello", "world"]));`

passes

`assert (md5Of(["hello", "world"]) == md5Of(["hello".dup, "world"]));`

fails.

-----

I propose that digest on an array of items which contain pointers does not just cast to ubyte[], but rather uses the (slower) range mechanism of applying digest to each item individually.

--