Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

GenerateHash

Calculate hash from input using selected algorithm

Task version: 2.0.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Task Parameters

Name
Description

HashFunction : Function

Generates input string to chosen HashAlgorithm type.

Possible values:

  • MD5: Generates input string to chosen HashAlgorithm type.

  • SHA1: Generates input string to chosen HashAlgorithm type.

  • SHA256: Generates input string to chosen HashAlgorithm type.

  • SHA384: Generates input string to chosen HashAlgorithm type.

  • SHA512: Generates input string to chosen HashAlgorithm type.

  • HMACSHA256: Generates input string to chosen HashAlgorithm type.

  • HMACSHA512: Generates input string to chosen HashAlgorithm type.

Default: MD5 Example: MD5

InputString : String

Input string to be hashed.

Default: - Example: foo

🗝HashKey : String

HashKey when using HMACSHA256 or HMACSHA512 HashAlgorithm type.

Default: - Example: foobar

Name
Description

ThrowErrorOnFailure : Boolean

Throw an exception if the task fails.

If set to false, the task returns an error result instead.

Default: True Example: true

ErrorMessageOnFailure : String

Custom error message to use when an error occurs.

Leave empty to use the original exception message.

Default: - Example: GenerateHash encountered an error while hashing the input string.

Task Result

Name
Description

Success : Boolean

Indicates whether the operation was successful. Example: true

Error : Error

Error information when the operation fails and ThrowErrorOnFailure is false. Example: { Message = "GenerateHash failed: input string cannot be null.", AdditionalInfo = "NullReferenceException" }

Error.Message : String

Error message. Example: An error occurred.

Error.AdditionalInfo : Exception

The exception that caused the error. Example: { Message = "Object reference not set to an instance of an object.", InnerException = "NullReferenceException" }

Hash : String

HashResult. Example: 8843d7f92416611de9ebb963fy4ce281v5932878

Task Changelog

Changelog for Task Frends.Cryptography.GenerateHash.

[2.0.0] - 2026-07-20

Changed

  • The task now targets .NET 8.

  • Added an Options parameter to control error handling: you can choose whether the task throws an exception on failure (ThrowErrorOnFailure) or returns an error result with details (ErrorMessageOnFailure).

  • The result now includes a Success flag and an Error object with details when the hash computation fails.

  • Breaking change: The GenerateHash method signature has been updated to include the new Options and CancellationToken parameters.

[1.0.0] - 2022-08-11

Added

  • Initial implementation

Last updated

Was this helpful?