28 lines
No EOL
575 B
C#
28 lines
No EOL
575 B
C#
using System;
|
|
|
|
using FrostFS.SDK.Cryptography;
|
|
|
|
namespace FrostFS.SDK;
|
|
|
|
public class FrostFsObjectId(string id)
|
|
{
|
|
public string Value { get; } = id;
|
|
|
|
public static FrostFsObjectId FromHash(ReadOnlySpan<byte> hash)
|
|
{
|
|
if (hash.Length != Constants.Sha256HashLength)
|
|
throw new FormatException("ObjectID must be a sha256 hash.");
|
|
|
|
return new FrostFsObjectId(Base58.Encode(hash));
|
|
}
|
|
|
|
public byte[] ToHash()
|
|
{
|
|
return Base58.Decode(Value);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Value;
|
|
}
|
|
} |