Reading file as a big number (for Cryptography)

From: Leo \(F.Hou\) (fh235-NOSPAM@cam.ac.uk)
Date: 12/20/02


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



Relevant Pages

  • shortest route from point to point on discontinuous line
    ... I've been braking my head over this, and i'm just stuck. ... I'm writing ... an algorithm that applies limits to a collection of objects and then ...
    (sci.math)
  • Re: Does Python really follow its philosophy of "Readability counts"?
    ... exist programs for which the algorithm gives the wrong answer. ... they want to be assisted with writing correct programs -- to the extent ... permissive languages more enjoyable. ... but Python comes very close. ...
    (comp.lang.python)
  • Re: Finding out the active Unix shell
    ... I'm writing a C program that runs a Java program (an agent) ... The agent's shell is unknown, so I need to check, within my C code ... "Debugging is twice as hard as writing the code in the first place. ...
    (comp.lang.c)
  • Re: write checks challenge
    ... > five," without causing ambiguity, an algorithm to automate the writing ... if I were writing the ...
    (comp.lang.fortran)
  • Re: Finding out the active Unix shell
    ... I'm writing a C program that runs a Java program (an agent) ... The agent's shell is unknown, so I need to check, within my C code ... "Debugging is twice as hard as writing the code in the first place. ...
    (comp.lang.c)