-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateHashes.cs
More file actions
26 lines (22 loc) · 853 Bytes
/
Copy pathCreateHashes.cs
File metadata and controls
26 lines (22 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Text;
using System.Threading.Tasks;
using Api2Convert;
namespace Api2Convert.Examples;
// Guide: Create Hashes — compute the SHA-256 checksum of a remote ZIP.
// Run: API2CONVERT_API_KEY=your-key dotnet run --project examples/Examples -- create-hashes
internal static class CreateHashes
{
public static async Task RunAsync()
{
using Api2ConvertClient client = Shared.NewClient();
ConversionResult result = await client.ConvertAsync(
Shared.Zip,
"sha256",
options: null,
opts: new ConvertOptions { Category = "hash" });
// The result is the hash itself; read it into memory.
byte[] bytes = await result.ContentsAsync();
Console.WriteLine($"SHA-256 result ({bytes.Length} bytes): {Encoding.UTF8.GetString(bytes)}");
}
}