Didn't come to stack overflow until just now. I refactored some code out of another project that was getting unwieldy.
Consider this problem space being well on its way to being solved.
https://dev.to/dmidlo/the-problem-powershells-hashing-illusion-74p