nxt.crypto

## Class SimpleShamirSecretSharing

- java.lang.Object
- - nxt.crypto.SimpleShamirSecretSharing

- All Implemented Interfaces:
    SecretSharing

      public final class SimpleShamirSecretSharing
      extends java.lang.Object
      implements SecretSharing

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.math.BigInteger` | `combine(SecretShare[] shares, java.math.BigInteger prime)` Given the needed number of shares or more, reproduce the original polynomial and extract the secret from its free term.
    `SecretShare[]` | `split(java.math.BigInteger secret, int needed, int available, java.math.BigInteger prime, java.util.Random random)` Given a secret, split it into "available" shares where providing "needed" shares is enough to reproduce the secret.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### split

          public SecretShare[] split(java.math.BigInteger secret,
                                     int needed,
                                     int available,
                                     java.math.BigInteger prime,
                                     java.util.Random random)

      Given a secret, split it into "available" shares where providing "needed" shares is enough to reproduce the secret. All calculations are performed mod p, where p is a large prime number.
      Specified by:
        `split` in interface `SecretSharing`
      Parameters:
        `secret` - the secret
        `needed` - the number of shares needed to reproduce it
        `available` - the total number of shares
        `prime` - the prime number
        `random` - the random source
      Returns:
        the secret shares

    - #### combine

          public java.math.BigInteger combine(SecretShare[] shares,
                                              java.math.BigInteger prime)

      Given the needed number of shares or more, reproduce the original polynomial and extract the secret from its free term. All calculations are performed mod p, where p is a large prime number
      Specified by:
        `combine` in interface `SecretSharing`
      Parameters:
        `shares` - the shares represention points over the polynomial
        `prime` - the prime number
      Returns:
        the original secret reproduced from the free term of the polynomial which passes through these points