Xecrets.Slip39.SharePrefix.md

May 26, 2026 · View on GitHub

Xecrets.Slip39

Xecrets.Slip39

SharePrefix Class

A representation of the share prefix, which consists of the parameters for the share.

public class SharePrefix

Inheritance System.Object → SharePrefix

Constructors

SharePrefix(byte[]) Constructor

Instantiate a SharePrefix from a binary representation.

public SharePrefix(byte[] prefix);

Parameters

prefix System.Byte[]

A System.Byte[] containing the binary prefix.

Fields

SharePrefix.LengthBits Field

The total length in bits of the share prefix.

public static readonly int LengthBits;

Field Value

System.Int32

Properties

SharePrefix.Extendable Property

The extendable backup flag (ext) field indicates that the id is used as salt in the encryption of the master secret when ext = 0.

public bool Extendable { get; }

Property Value

System.Boolean

SharePrefix.GroupCount Property

The group count (g) indicates the total number of groups. The actual value is encoded as g = G − 1.

public int GroupCount { get; }

Property Value

System.Int32

SharePrefix.GroupIndex Property

The group index (GI) field is the x value of the group share.

public int GroupIndex { get; }

Property Value

System.Int32

SharePrefix.GroupThreshold Property

The group threshold (Gt) field indicates how many group shares are needed to reconstruct the master secret. The actual value is encoded as Gt = GT − 1, so a value of 0 indicates that a single group share is needed (GT = 1), a value of 1 indicates that two group shares are needed (GT = 2) etc.

public int GroupThreshold { get; }

Property Value

System.Int32

SharePrefix.Id Property

The identifier (id) field is a random 15-bit value which is the same for all shares and is used to verify that the shares belong together.

public int Id { get; }

Property Value

System.Int32

SharePrefix.IterationExponent Property

The iteration exponent (e) field indicates the total number of iterations to be used in PBKDF2. The number of iterations is calculated as 10000×2^e.

public int IterationExponent { get; }

Property Value

System.Int32

SharePrefix.MemberIndex Property

The member index (I) field is the x value of the member share in the given group.

public int MemberIndex { get; }

Property Value

System.Int32

SharePrefix.MemberThreshold Property

The member threshold (t) field indicates how many member shares are needed to reconstruct the group share. The actual value is encoded as t = T − 1.

public int MemberThreshold { get; }

Property Value

System.Int32

Methods

SharePrefix.GenerateId(IRandom) Method

Generate a random id for the prefix.

public static int GenerateId(Xecrets.Slip39.IRandom random);

Parameters

random IRandom

The IRandom instance to use.

Returns

System.Int32
An integer suitable as a random id for a share.