-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1350fde
commit e336d62
Showing
7 changed files
with
67 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// HashingHandler by Simon Field | ||
|
||
using System; | ||
|
||
namespace HashingHandler; | ||
|
||
/// <summary> | ||
/// Verifies hashes of objects of type <typeparamref name="T"/> using a given hashing provider. | ||
/// </summary> | ||
/// <typeparam name="T">The type of objects to verify the hashes of.</typeparam> | ||
public class HashVerifierGeneric<T> : HashVerifierBase<T> | ||
{ | ||
private StringComparison UserComparisonMethod { get; } | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="HashVerifierGeneric{T}"/> with the given hashing provider. | ||
/// The default string comparison method will be used, <see cref="StringComparison.OrdinalIgnoreCase"/>. | ||
/// </summary> | ||
/// <param name="provider">The provider for converting this data type to byte array.</param> | ||
public HashVerifierGeneric(IHashingProvider<T> provider, StringComparison method = DefaultComparisonMethod) | ||
{ | ||
HashProvider = provider; | ||
UserComparisonMethod = method; | ||
} | ||
|
||
protected override IHashingProvider<T> HashProvider { get; } | ||
|
||
protected override StringComparison ComparisonMethod => UserComparisonMethod; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// HashingHandler by Simon Field | ||
|
||
namespace HashingHandler; | ||
|
||
public interface IStringEncoding | ||
{ | ||
/// <summary> | ||
/// Converts a <see cref="byte"/>[] to a <see cref="string"/>. | ||
/// </summary> | ||
/// <param name="bytes">The <see cref="byte"/>[] to convert.</param> | ||
/// <returns>A <see cref="string"/> representing the <see cref="byte"/>[] <paramref name="bytes"/>.</returns> | ||
public string ConvertToString(byte[] bytes); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters