public class Scheme extends Object
Constructor and Description |
---|
Scheme(int n,
int k)
Creates a new
Scheme instance. |
Modifier and Type | Method and Description |
---|---|
okio.ByteString |
join(Set<Part> parts)
Joins the given parts to recover the original secret.
|
Set<Part> |
split(okio.ByteString secret)
Splits the given secret into
n parts, of which any k or more can be combined
to recover the original secret. |
public Scheme(int n, int k)
Scheme
instance.n
- the number of parts to produce (must be >1
)k
- the threshold of joinable parts (must be <= n
)public Set<Part> split(okio.ByteString secret)
n
parts, of which any k
or more can be combined
to recover the original secret.secret
- the secret to splitn
Part
instancespublic okio.ByteString join(Set<Part> parts)
N.B.: There is no way to determine whether or not the returned value is actually the original secret. If the parts are incorrect, or are under the threshold value used to split the secret, a random value will be returned.
parts
- a set of Part
instancesIllegalArgumentException
- if parts
is empty or contains values of varying
lengthsCopyright © 2017. All rights reserved.