WALTER | Workable Algorithms for Location-aware Transmission, Encryption Response

DeterministicEncryption..::..TryDecrypt Method (Span<(Of <(<'Byte>)>)>, array<Byte>[]()[][]%, array<Nullable<(Of <(<'Byte>)>)>>[]()[][]%)

Tries to decrypt the specified cipher bytes if the provided hash matches.

Namespace:  Walter.Cypher
Assembly:  Walter.Cypher (in Walter.Cypher.dll)

Syntax


public bool TryDecrypt(
	Span<byte> cypherBytes,
	ref byte[] hash,
	out Nullable<byte>[] clearBytes
)

Parameters

cypherBytes
Type: Span<(Of <(<'Byte>)>)>
The cipher bytes to decrypt.
hash
Type: array<Byte>[]()[][]%
The hash to validate against the cipher bytes.
clearBytes
Type: array<Nullable<(Of <(<'Byte>)>)>>[]()[][]%
The decrypted data, if decryption is successful.

Return Value

true if decryption is successful and the hash matches; otherwise, false.

Exceptions


ExceptionCondition
ArgumentNullException Thrown when either cypherBytes or hash is null.

Remarks


This method first validates that the provided hash matches the hash of the cipher bytes. If the hashes match, it proceeds with decryption. If not, it logs a critical error and returns false.