Improve and dedup GetNonZeroBytes (#81340)
authorStephen Toub <stoub@microsoft.com>
Tue, 31 Jan 2023 12:50:56 +0000 (07:50 -0500)
committerGitHub <noreply@github.com>
Tue, 31 Jan 2023 12:50:56 +0000 (07:50 -0500)
commit4cbbaea2f9221992f24eae3d0630ba37d2d7cb0a
tree5e95c8ca33e3824f32e0e4c3c454c6b210321d35
parent7c4b59ccf2cfc74c54e6c8922ab80cda20c3a55e
Improve and dedup GetNonZeroBytes (#81340)

- RsaPaddingProcessor has its own complete copy; that now appears to be an unnecessary duplication.
- If a zero byte is found, the implementation currently looks at the rest of the bytes byte by byte.  We expect 0s to be rare, so copy in bulk instead.
src/libraries/Common/src/System/Security/Cryptography/RsaPaddingProcessor.cs
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RandomNumberGeneratorImplementation.cs