SecurityAliases.

CalculateFileHash(ICakeContext, FilePath, HashAlgorithm) Method

Summary

Calculates the hash for a given file.
Namespace
Cake.Common.Security
Containing Type
SecurityAliases

Syntax

[CakeMethodAlias]
public static FileHash CalculateFileHash(this ICakeContext context, FilePath filePath, HashAlgorithm hashAlgorithm)

Examples

Information(
    "Cake executable file MD5 hash: {0}",
    CalculateFileHash("Cake.exe", HashAlgorithm.MD5).ToHex());

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.

Parameters

Name Type Description
context ICakeContext The context.
filePath FilePath The file path.
hashAlgorithm HashAlgorithm The hash algorithm to use.

Return Value

Type Description
FileHash A FileHash instance representing the calculated hash.