SSS class

Constructors

SSS()

Properties

hashCode int
The hash code for this object.
no setterinherited
maxInt16 int
final
part int
16bit, because random.nextInt() only supports (2^32)-1 possible values.
final
prime BigInt
final
rand Random
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

combine(List<String> shares, bool isBase64) String
Takes a string array of shares encoded in Base64 or Hex created via Shamir's Algorithm Note: the polynomial will converge if the specified minimum number of shares or more are passed to this function. Passing thus does not affect it Passing fewer however, simply means that the returned secret is wrong.
create(int minimum, int shares, String secret, bool isBase64) List<String>
Returns a new array of secret shares (encoding x,y pairs as Base64 or Hex strings) created by Shamir's Secret Sharing Algorithm requiring a minimum number of share to recreate, of length shares, from the input secret raw as a string.
decodeShareBase64(List<String> shares) List<List<List<BigInt>>>
Takes a string array of shares encoded in Base64 created via Shamir's Algorithm; each string must be of equal length of a multiple of 88 characters as a single 88 character share is a pair of 256-bit numbers (x, y).
decodeShareHex(List<String> shares) List<List<List<BigInt>>>
Takes a string array of shares encoded in Hex created via Shamir's Algorithm; each string must be of equal length of a multiple of 128 characters as a single 128 character share is a pair of 256-bit numbers (x, y).
evaluatePolynomial(List<List<BigInt>> poly, int part, BigInt x) BigInt
Compute the polynomial value using Horner's method. https://en.wikipedia.org/wiki/Horner%27s_method y = a + bx + cx^2 + dx^3 = ((dx + c)x + b)x + a
fromBase64(String number) BigInt
Return BigInt from Base64 string.
fromBase64Url(String number) BigInt
Return BigInt from Base64Url string.
fromHex(String number) BigInt
Return BigInt from Hex string.
genNumber() String
Generate number 256-bits base 10.
hexToU8(String hex) Uint8List
Convert hex string to Uint8List
inNumbers(List<BigInt> numbers, BigInt value) bool
inNumbers(array, value) returns boolean whether or not value is in array.
isValidShareBase64(String candidate) bool
Takes in a given string to check if it is a valid secret Requirements: Length multiple of 88 Can decode each 44 character block as Base64 Returns only success/failure (bool)
isValidShareHex(String candidate) bool
Takes in a given string to check if it is a valid secret Requirements: Length multiple of 128 Can decode each 64 character block as Hex Returns only success/failure (bool)
mergeBigIntToString(List<BigInt> secrets) String
Converts an array of BigInt to the original byte array, removing any least significant nulls.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
randomNumber() BigInt
Returns a random number from the range (0, PRIME-1) inclusive
splitSecretToBigInt(String secret) List<BigInt>
Converts a byte array into an a 256-bit BigInt, array based upon size of the input byte; all values are right-padded to length 256 bit, even if the most significant bit is zero.
toBase64(BigInt number) String
Return Base64 string from BigInt 256 bits long
toBase64Url(BigInt number) String
Return Base64Url string from BigInt 256 bits long
toHex(BigInt number) String
Return Hex string from BigInt 256 bits long
toString() String
A string representation of this object.
inherited
trimRight(String hexData) String
Remove right character '0'
u8ToHex(Uint8List u8) String
Convert Uint8List to hex string

Operators

operator ==(Object other) bool
The equality operator.
inherited