SecurityAliases.

CalculateFileHash(ICakeContext, FilePath) Method

Summary

Calculates the hash for a given file using the default (SHA256) algorithm.
Namespace
Cake.Common.Security
Containing Type
SecurityAliases

Syntax

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

Examples

Information(
   "Cake executable file SHA256 hash: {0}",
   CalculateFileHash("Cake.exe").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.

Return Value

Type Description
FileHash A FileHash instance representing the calculated hash.