Files @ 438dcebc9c63
Branch filter:

Location: Shamira/src/shamira.py - annotation

Laman
splitting the secret
import os

import gf256


def shareByte(secretB,k,n):
	assert n<255
	coefs=[int(secretB)]+[int(b) for b in os.urandom(k-1)]
	points=[gf256.evaluate(coefs,i) for i in range(1,n+1)]
	return points


def generate(secret,k,n):
	shares=[shareByte(b,k,n) for b in secret]
	return [(i+1, [s[i] for s in shares]) for i in range(n)]


print(generate(b"key",2,3))