SHA

Undocumented in source.

Members

Aliases

update
alias update = put
Undocumented in source.

Functions

finish
ubyte[digestLength] finish()

Calculate the final hash value.

put
void put(const(ubyte)[] input)
Undocumented in source. Be warned that the author may not have intended to support it.
start
void start()

Reset the digest to its initial state. It is not necessary to call start after finish or doFinal.

Manifest constants

blockSize
enum blockSize;
Undocumented in source.
blockSize
enum blockSize;
Undocumented in source.
digestLength
enum digestLength;
Undocumented in source.
name
enum name;
Undocumented in source.

Examples

testing SHA256 algorithm

t {
	
	immutable string[] plaintexts = [
		x"",
		x"",	// twice the same to test start()
		x"616263",
		"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
		
	];
	
	immutable string[] hexHashes = [
		x"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
		x"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
		x"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
		x"cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1"
	];

	testDigest(new SHA256Digest, plaintexts, hexHashes

testing SHA384 algorithm

t {

	immutable string[] plaintexts = [
		x"",
		x"",	// twice the same to test start()
		x"616263",
		"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
		
	];
	
	immutable string[] hexHashes = [
		x"38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b",
		x"38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b",
		x"cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7",
		x"09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039"
	];

	testDigest(new SHA384Digest, plaintexts, hexHashes

testing SHA512 algorithm

t {

	immutable string[] plaintexts = [
		x"",
		x"",	// twice the same to test start()
		x"616263",
		"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"
	];
	
	immutable string[] hexHashes = [
		x"cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e",
		x"cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e",
		x"ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
		x"8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909"
	];

	
	testDigest(new SHA512Digest, plaintexts, hexHashes

Meta