
This commit lays the groundwork for a user-configurable image processing pipeline. It has exactly the same behavior as the old ImageProcessor, just modular & compartmentalized. It also adds support for AVIF & JXL encoding, though no code paths call it just yet.
24 lines
No EOL
620 B
C#
24 lines
No EOL
620 B
C#
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace Iceshrimp.Backend.Core.Helpers;
|
|
|
|
public static class DigestHelpers
|
|
{
|
|
public static async Task<string> Sha256DigestAsync(string input)
|
|
{
|
|
var bytes = Encoding.UTF8.GetBytes(input);
|
|
return await Sha256DigestAsync(new MemoryStream(bytes));
|
|
}
|
|
|
|
public static async Task<string> Sha256DigestAsync(Stream input)
|
|
{
|
|
var data = await SHA256.HashDataAsync(input);
|
|
return Convert.ToHexString(data).ToLowerInvariant();
|
|
}
|
|
|
|
public static async Task<string> Sha256DigestAsync(byte[] input)
|
|
{
|
|
return await Sha256DigestAsync(new MemoryStream(input));
|
|
}
|
|
} |