XTS-AES implementation: SectorStream
As a by-product of the XtsSharp project, I implemented a SectorStream, which is a stream that reads and writes whole sectors (the size of which is configurable) to enable the XTS algorithm to operate on standard .NET streams.
I also implemented another stream based class that provides random access to an underlying SectorStream. This simulates random access by reading and writing entire sectors at once. This stream is called (yep, you guessed it) RandomAccessSectorStream.
The result is that you can use the random access stream to wrap a SectorStream and read and write to it as if it was just a normal .NET stream. It supports seeking to arbitrary points and reading / writing. The class handles the sector by sector reading and writing, which when using an XTSSectorStream, encrypts (when writing) and decrypts (when reading).
I’m not sure if this is usable outside of the XTS project, but it is completely separate code-wise, so maybe someone will find a use for it.