NethermindEth / cortex-ssz

An implementation of the ETH2.0 Simple Serialize (SSZ) specification, for .NET Core (written in C#).
Other
1 stars 4 forks source link

Bugfix/concurrent access to static hashing algorithm instance #3

Open roktomc opened 7 months ago

roktomc commented 7 months ago

Fixes an issue of using a single static instance of SHA256 HashAlgorithm which is not thread safe (more on that can be found here https://stackoverflow.com/questions/73006466/is-hashalgorithm-computehash-thread-safe or here https://wanderingdeveloper.medium.com/c-cautionary-tail-the-dangers-of-sha256-reuse-2b5bb9c6fde9).

Creating multiple SszTree instances from concurrent threads randomly calculated wrong roots.