[#11] Add Network Snapshot
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
b69d22966f
commit
c988ff3c76
84 changed files with 2238 additions and 933 deletions
34
src/FrostFS.SDK.ModelsV2/Object/ObjectId.cs
Normal file
34
src/FrostFS.SDK.ModelsV2/Object/ObjectId.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
|
||||
using FrostFS.SDK.Cryptography;
|
||||
|
||||
namespace FrostFS.SDK.ModelsV2;
|
||||
|
||||
public class ObjectId
|
||||
{
|
||||
public string Value { get; }
|
||||
|
||||
public ObjectId(string id)
|
||||
{
|
||||
Value = id;
|
||||
}
|
||||
|
||||
public static ObjectId FromHash(byte[] hash)
|
||||
{
|
||||
if (hash.Length != Constants.Sha256HashLength)
|
||||
{
|
||||
throw new FormatException("ObjectID must be a sha256 hash.");
|
||||
}
|
||||
return new ObjectId(Base58.Encode(hash));
|
||||
}
|
||||
|
||||
public byte[] ToHash()
|
||||
{
|
||||
return Base58.Decode(Value);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue