[#1] Move files to top level directory
Signed-off-by: Ivan Pchelintsev <i.pchelintsev@yadro.com>
This commit is contained in:
parent
013d8a8436
commit
11eff4e23e
76 changed files with 0 additions and 0 deletions
32
src/FrostFS.SDK.ModelsV2/ObjectId.cs
Normal file
32
src/FrostFS.SDK.ModelsV2/ObjectId.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
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