Reading file as a big number (for Cryptography)
From: Leo \(F.Hou\) (fh235-NOSPAM@cam.ac.uk)
Date: 12/20/02
- Next message: Brad: "Annoying password noodge"
- Previous message: John Smith: "Re: Software Update Services (SUS) - SA Edition"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Leo \(F.Hou\)" <fh235-NOSPAM@cam.ac.uk> Date: Fri, 20 Dec 2002 12:49:05 -0000
Dear all,
I am writing a java program that implements Adi Shamir's "How to Share a
Secret" (http://szabo.best.vwh.net/secret.html) algorithm.
It achieves a Simple (k, n) Threshold Scheme using polynomial (*)
interpolation: given k points in the 2-dimensional plane (x1, y1), ... (xk,
yk) with distinct xi's, there is one and only one polynomial q(x) of degree
k - i such that q(xi) = yi for all i.
(*) The polynomials can be replaced by any other collection of functions
which are easy to evaluate and to interpolate.
Without loss of generality, we can assume that the data D is (or can be
made) a number. To divide it into pieces Di, we pick a random k - 1 degree
polynomial q(x) = a[0] + a[1] * x + ... a[k-1] * x^(k-1) in which a[0] = D,
and evaluate: D1 = q(1), ..., Di = q(i), ..., Dn = q(n).
Given any subset of k of these Di values (together with their identifying
indices), we can find the coefficients of q(x) by interpolation, and then
evaluate D = q(O). Knowledge of just k - 1 of these values, on the other
hand, does not suffice in order to calculate D.
Here D is a number. The program I am writing can work with any type of
files. i.e. It looks like some kind of spliter (not reducing the size
though). It produce n shares for one file, of which more than k shares can
recover the file.
Question: How can I read files into very big/huge numbers?
Is java's Math.BigNum class sufficient for this algorithm?
I can do it in two ways,
1. Try to read a file to a single very big number and do the calculations.
2. Read parts of the file to not very big numbers, work out the shares and
put more than one Dn in one *Share file*.
Considering the overhead of the 2nd approach, which approach is better?
Thank you in advance
Leo
- Next message: Brad: "Annoying password noodge"
- Previous message: John Smith: "Re: Software Update Services (SUS) - SA Edition"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|