32 lines
No EOL
630 B
C#
32 lines
No EOL
630 B
C#
using FrostFS.SDK.Cryptography;
|
|
|
|
namespace FrostFS.SDK.ModelsV2;
|
|
|
|
public class ContainerId
|
|
{
|
|
public string Value { get; set; }
|
|
|
|
public ContainerId(string id)
|
|
{
|
|
Value = id;
|
|
}
|
|
|
|
public static ContainerId FromHash(byte[] hash)
|
|
{
|
|
if (hash.Length != Constants.Sha256HashLength)
|
|
{
|
|
throw new FormatException("ContainerID must be a sha256 hash.");
|
|
}
|
|
return new ContainerId(Base58.Encode(hash));
|
|
}
|
|
|
|
public byte[] ToHash()
|
|
{
|
|
return Base58.Decode(Value);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Value;
|
|
}
|
|
} |