Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Support Span<byte> as Hash-function input #55

Open
aKzenT opened this issue Jan 11, 2020 · 0 comments
Open

Support Span<byte> as Hash-function input #55

aKzenT opened this issue Jan 11, 2020 · 0 comments

Comments

@aKzenT
Copy link

aKzenT commented Jan 11, 2020

It would be very useful for the hash functions to accept a ReadOnlySpan instead of only Stream and byte[]. More and more .NET apis are enabled for use with the various Span-datatypes and so it also happens quite often, that instead of a byte[] you are dealing with a Span, which cannot directly be used with this library.

Another advantage is the possibility to cast between various types of Span-types with the help of MemoryMarshal. This makes it possible to cast a string to a ReadOnlySpan without having to encode or copy the string first. As I often want to compute hashes from strings, this would drastically improve the performance and reduce needed allocations.

I would also be happy if this would only be supported in the block-transformer interfaces in the beginning, where you already support ArraySegment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant