Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async void HashAlgorithmComputeHashAsyncShouldProduceExpectedResultWithTw
{
// Given
using HashAlgorithm algorithm = SHA256.Create();
Stream data = new MemoryStream(Encoding.Default.GetBytes("abc123"));
Stream data = new MemoryStream("abc123"u8.ToArray());
const string expected = "efaaeb3b1d1d85e8587ef0527ca43b9575ce8149ba1ee41583d3d19bd130daf8";

// When
Expand Down
2 changes: 1 addition & 1 deletion OnixLabs.Security.Cryptography/Extensions.HashAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static byte[] ComputeHash(this HashAlgorithm algorithm, byte[] data, int
/// <param name="rounds">The number of rounds that the input data should be hashed.</param>
/// <returns>Returns the computed hash value.</returns>
public static byte[] ComputeHash(this HashAlgorithm algorithm, ReadOnlySpan<char> data, Encoding? encoding = null, int rounds = 1) =>
algorithm.ComputeHash((encoding ?? Encoding.Default).GetBytes(data.ToArray()), rounds);
algorithm.ComputeHash((encoding ?? Encoding.UTF8).GetBytes(data.ToArray()), rounds);

/// <summary>
/// Computes the hash value for the specified <see cref="Stream"/> object.
Expand Down