Skip to content
Taiizor edited this page Mar 1, 2023 · 2 revisions

HashExtension Class

HashExtension is a static class that provides extension methods for hashing operations.

Methods

FileToMD5

Returns the MD5 hash of a file as a string.

Parameters

  • Path: The path of the file to hash. Default value is MHHM.Path.
  • Split: The character(s) used to separate the hash string. Default value is MHHM.Split.
  • Upper: If true, the hash string will be in uppercase. Default value is MHHM.Upper.
  • Invariant: If true, the hash string will use the invariant culture. Default value is MHHM.Invariant.

Returns

A string representing the MD5 hash of the file.

Exceptions

  • E: If the file cannot be found or read.

FileToMD5Async

Returns a task that asynchronously computes the MD5 hash of a file as a string.

Parameters

  • Path: The path of the file to hash. Default value is MHHM.Path.
  • Split: The character(s) used to separate the hash string. Default value is MHHM.Split.
  • Upper: If true, the hash string will be in uppercase. Default value is MHHM.Upper.
  • Invariant: If true, the hash string will use the invariant culture. Default value is MHHM.Invariant.

Returns

A task that represents the asynchronous operation. The task result contains a string representing the MD5 hash of the file.

FileToSHA1

Returns the SHA1 hash of a file as a string.

Parameters

  • Path: The path of the file to hash. Default value is MHHM.Path.
  • Split: The character(s) used to separate the hash string. Default value is MHHM.Split.
  • Upper: If true, the hash string will be in uppercase. Default value is MHHM.Upper.
  • Invariant: If true, the hash string will use the invariant culture. Default value is MHHM.Invariant.

Returns

A string representing the SHA1 hash of the file.

Exceptions

  • E: If the file cannot be found or read.
Clone this wiki locally