public void TestObjectGetRangeHash() { var host = "localhost:8080"; var key = "KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr".LoadWif(); var cid = ContainerID.FromBase58String("Bun3sfMBpnjKc3Tx7SdwrMxyNi8ha8JT3dhuFGvYBRTz"); var oid = ObjectID.FromBase58String("vWt34r4ddnq61jcPec4rVaXHg7Y7GiEYFmcTB2Qwhtx"); var address = new Address(cid, oid); var client = new Client.Client(key, host); var source1 = new CancellationTokenSource(); source1.CancelAfter(TimeSpan.FromMinutes(1)); var session = client.CreateSession(source1.Token, ulong.MaxValue); source1.Cancel(); var source2 = new CancellationTokenSource(); source2.CancelAfter(TimeSpan.FromMinutes(1)); var o = client.GetObjectPayloadRangeHash(source2.Token, new RangeChecksumParams { Address = address, Ranges = new List <Object.Range> { new Object.Range { Offset = 0, Length = 3 } }, Salt = new byte[] { 0x00 }, Type = ChecksumType.Sha256 }, new CallOptions { Ttl = 2, Session = session }); Assert.AreEqual(1, o.Count); Assert.AreEqual(Encoding.ASCII.GetBytes("hello")[..3].Sha256().ToHexString(), o[0].ToHexString());
public void TestObjectGetRangeHash() { using var client = new Client.Client(key, host); using var source = new CancellationTokenSource(); source.CancelAfter(TimeSpan.FromMinutes(1)); var o = client.GetObjectPayloadRangeHash(Address, new List <Object.Range> { new Object.Range { Offset = 0, Length = 100 } }, ChecksumType.Sha256, new byte[] { }, new CallOptions { Ttl = 2 }, source.Token).Result; Console.WriteLine($"{o.Count} {string.Join(", ", o.Select(p => p.ToHexString()))}"); }