[#40] Client: Add memory optimization for hash
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
6ae96c1d77
commit
f93e33b49b
1 changed files with 1 additions and 14 deletions
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
using FrostFS.Refs;
|
using FrostFS.Refs;
|
||||||
|
@ -14,7 +13,6 @@ using Org.BouncyCastle.Crypto.Digests;
|
||||||
using Org.BouncyCastle.Crypto.Parameters;
|
using Org.BouncyCastle.Crypto.Parameters;
|
||||||
using Org.BouncyCastle.Crypto.Signers;
|
using Org.BouncyCastle.Crypto.Signers;
|
||||||
using Org.BouncyCastle.Math;
|
using Org.BouncyCastle.Math;
|
||||||
using Org.BouncyCastle.Utilities;
|
|
||||||
using Signature = FrostFS.Refs.Signature;
|
using Signature = FrostFS.Refs.Signature;
|
||||||
|
|
||||||
namespace FrostFS.SDK.Client;
|
namespace FrostFS.SDK.Client;
|
||||||
|
@ -106,18 +104,7 @@ public static class RequestSigner
|
||||||
|
|
||||||
internal static Signature SignMessagePart(this ClientKey key, IMessage? data)
|
internal static Signature SignMessagePart(this ClientKey key, IMessage? data)
|
||||||
{
|
{
|
||||||
if (data is null)
|
if (data is null || data.CalculateSize() == 0)
|
||||||
{
|
|
||||||
return new Signature
|
|
||||||
{
|
|
||||||
Key = key.PublicKeyProto,
|
|
||||||
Sign = key.ECDsaKey.SignData(ReadOnlyMemory<byte>.Empty),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var size = data.CalculateSize();
|
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
{
|
{
|
||||||
return new Signature
|
return new Signature
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue