Module std.digest.sha
Computes SHA1 and SHA2 hashes of arbitrary data. SHA hashes are 20 to 64 byte quantities (depending on the SHA algorithm) that are like a checksum or CRC, but are more robust.
| Category | Functions | 
|---|---|
| Template API | SHA1 | 
| OOP API | SHA1Digest | 
| Helpers | sha1Of | 
SHA2 comes in several different versions, all supported by this module: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256.
 This module conforms to the APIs defined in std. To understand the
 differences between the template and the OOP API, see std.
 This module publicly imports std and can be used as a stand-alone
 module.
CTFE
Digests do not work in CTFE
References
Example
//Template API
import stdExample
//OOP API
import stdFunctions
| Name | Description | 
|---|---|
| 
									sha1Of(data)
								 | These are convenience aliases for stdusing the
 SHA implementation. | 
| 
									sha224Of(data)
								 | These are convenience aliases for stdusing the
 SHA implementation. | 
| 
									sha256Of(data)
								 | These are convenience aliases for stdusing the
 SHA implementation. | 
| 
									sha384Of(data)
								 | These are convenience aliases for stdusing the
 SHA implementation. | 
| 
									sha512_224Of(data)
								 | These are convenience aliases for stdusing the
 SHA implementation. | 
| 
									sha512_256Of(data)
								 | These are convenience aliases for stdusing the
 SHA implementation. | 
| 
									sha512Of(data)
								 | These are convenience aliases for stdusing the
 SHA implementation. | 
Structs
| Name | Description | 
|---|---|
| 
									SHA
								 | Template API SHA1/SHA2 implementation. Supports: SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256. | 
Aliases
| Name | Type | Description | 
|---|---|---|
| SHA1 | SHA!(512,160) | SHA alias for SHA-1, hash is ubyte[20] | 
| SHA1Digest | std | OOP API SHA1 and SHA2 implementations.
 See stdfor differences between template and OOP API. | 
| SHA224 | SHA!(512,224) | SHA alias for SHA-224, hash is ubyte[28] | 
| SHA224Digest | std | OOP API SHA1 and SHA2 implementations.
 See stdfor differences between template and OOP API. | 
| SHA256 | SHA!(512,256) | SHA alias for SHA-256, hash is ubyte[32] | 
| SHA256Digest | std | OOP API SHA1 and SHA2 implementations.
 See stdfor differences between template and OOP API. | 
| SHA384 | SHA!(1024,384) | SHA alias for SHA-384, hash is ubyte[48] | 
| SHA384Digest | std | OOP API SHA1 and SHA2 implementations.
 See stdfor differences between template and OOP API. | 
| SHA512 | SHA!(1024,512) | SHA alias for SHA-512, hash is ubyte[64] | 
| SHA512_224 | SHA!(1024,224) | SHA alias for SHA-512/224, hash is ubyte[28] | 
| SHA512_224Digest | std | OOP API SHA1 and SHA2 implementations.
 See stdfor differences between template and OOP API. | 
| SHA512_256 | SHA!(1024,256) | SHA alias for SHA-512/256, hash is ubyte[32] | 
| SHA512_256Digest | std | OOP API SHA1 and SHA2 implementations.
 See stdfor differences between template and OOP API. | 
| SHA512Digest | std | OOP API SHA1 and SHA2 implementations.
 See stdfor differences between template and OOP API. | 
Authors
The routines and algorithms are derived from the
 Secure Hash Signature Standard (SHS) (FIPS PUB 180-2). 
 Kai Nacke, Johannes Pfau, Nick Sabalausky