View source code
							
							
						
								Display the source code in std/digest/package.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						std.digest.Digest/digest  - multiple declarations
				Function digest
This is a convenience function to calculate a hash using the template API.
 Every digest passing the isDigest test can be used with this function.
						
				DigestType!Hash digest(Hash, Range)
				(
				
				  auto ref Range range
				
				)
				
				if (!isArray!Range && isDigestibleRange!Range);
						
					
				Parameters
| Name | Description | 
|---|---|
| range | an InputRangewithElementTypeubyte,ubyte[]orubyte[num] | 
Example
import stdFunction digest
This overload of the digest function handles arrays.
						
					
				Parameters
| Name | Description | 
|---|---|
| data | one or more arrays of any type | 
Example
import stdExample
import stdInterface Digest
This describes the OOP API. To understand when to use the template API and when to use the OOP API, see the module documentation at the top of this page.
						
				interface Digest
				;
						
					
				The Digest interface is the base interface which is implemented by all digests.
Properties
| Name | Type | Description | 
|---|---|---|
| length[get] | ulong | This is the length in bytes of the hash value which is returned by finish.
 It's also the required size of a buffer passed tofinish. | 
Methods
| Name | Description | 
|---|---|
| digest | This is a convenience function to calculate the hash of a value using the OOP API. | 
| finish | The finish function returns the hash value. It takes an optional buffer to copy the data
 into. If a buffer is passed, it must be at least lengthbytes big. | 
| put | Use this to feed the digest with data.
 Also implements the isOutputRangeinterface forubyteandconst(ubyte)[]. | 
| reset | Resets the internal state of the digest. | 
Note
A Digest implementation is always an OutputRange
Example
//Using the OutputRange feature
import stdExample
import stdExample
import stdExample
void test(Digest dig)
{
    digAuthors
Johannes Pfau
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.