Class ContentHasher
Computes Dropbox API content hashes for file contents.
Inherited Members
Namespace: Dropbox.Api.Files
Assembly: Dropbox.Api.dll
Syntax
public static class ContentHasher
Remarks
Dropbox content hashes are computed by splitting content into 4 MiB blocks, hashing each block with SHA-256, concatenating those block hashes, and SHA-256 hashing the concatenation.
Fields
View SourceBlockSize
The number of bytes in each Dropbox content hash block.
Declaration
public const int BlockSize = 4194304
Field Value
| Type | Description |
|---|---|
| int |
Methods
View SourceComputeHash(Stream)
Computes the Dropbox API content hash for the stream from its current position to the end of the stream.
Declaration
public static string ComputeHash(Stream content)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | content | The content stream to hash. |
Returns
| Type | Description |
|---|---|
| string | The lowercase hexadecimal Dropbox API content hash. |
ComputeHashAsync(Stream)
Computes the Dropbox API content hash for the stream from its current position to the end of the stream.
Declaration
public static Task<string> ComputeHashAsync(Stream content)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | content | The content stream to hash. |
Returns
| Type | Description |
|---|---|
| Task<string> | The task that represents the asynchronous hash operation. The TResult parameter contains the lowercase hexadecimal Dropbox API content hash. |
WithoutAutoContentHash(Stream)
Returns a stream wrapper that disables automatic SDK content hash population for upload requests.
Declaration
public static Stream WithoutAutoContentHash(Stream content)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | content | The upload content stream. |
Returns
| Type | Description |
|---|---|
| Stream | A stream wrapper that disables automatic content hash population. |
Remarks
A manually supplied ContentHash value on the upload argument is still sent. This wrapper delegates reads, seeking, and disposal to the wrapped stream.