Dropbox .NET SDK
Show / Hide Table of Contents

Class ContentHasher

Computes Dropbox API content hashes for file contents.

Inheritance
object
ContentHasher
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
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 Source

BlockSize

The number of bytes in each Dropbox content hash block.

Declaration
public const int BlockSize = 4194304
Field Value
Type Description
int

Methods

View Source

ComputeHash(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.

View Source

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.

View Source

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.

  • View Source
In this article
Back to top Dropbox .NET SDK