OK Kevin, you win 2nd prize - you get to buy me a drink.
Cary
At 09:12 AM 10/4/2000 +0930, you wrote:
>I recognise this immediately as the formula for calculating Bill Gates'
>wealth by the second, in real time.
>
>
>********************************
>Kevin Parker
>Service and Communication
>WorkCover Corporation
>
>[EMAIL PROTECTED]
>
>ph: +61 8 82332548
>fax: +61 8 82332000
>********************************
>
>
>-----Original Message-----
>From: Cary Gordon [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, 4 October 2000 5:07:AM
>To: CF-Talk
>Subject: OT: Harder Math Question
>
>
>Any idea of how I can turn this algorithm a custom tag? It is in
>Mathematica format as that is the only way I could think of to post it here.
>
> StringToMatrices[text_String]:= Partition[Parition[Flatten
> [Append[StringToList[text],{32,32,32}]],2],2]
>
> _______________________________________________________________
>
> MatriceToString[l_List] :=
> StringJoin [ ConvertNumber/@Flatten[1]]
>
> _______________________________________________________________
>
> CPpqn[digits_Integer] :=Module[{
> p1 = FirstPrimeAbove[Random[Integer,
> {10^(Floor[digits/2]-1), 10^(Floor[digits/2])-1}]],
> q1 = FirstPrimeAbove[Random[Integer,
> {10^(Floor[digits/2]-1), 10^(Floor[digits/2])-1}]],
> While[PrimeQ[p = 2p1 +1], p1 = FirstPrimeAbove[p1 + 1]]; p;
> While[PrimeQ[q = 2q1 +1], q1 = FirstPrimeAbove[q1 + 1]];
> q; n = pq; ]
>
> _______________________________________________________________
>
> randmatrix := (Catch[
> Do[m = Table[Random[Integer, {0, n}], {i, 1, 2}, {j, 1, 2}];
> If[GCD[Mod[Det[m], n], n] == 1, Throw[m]], {1000}]])
>
> _______________________________________________________________
>
> inv[a_] := (d = Mod[Det[a], n]; i = PowerMod[d, -1, n];
> {{Mod[i * a[[2, 2]], n], Mod[-i * a[[1, 2]], n]},
> {Mod[-i * a[[2, 1]], n], Mod[i * a[[1, 1]], n]}})
>
> _______________________________________________________________
>
> mmul[j_, k_] := Mod[
> {{Mod[j[[1, 1]]*k[[1, 1]], n] + Mod[j[[1, 2]]*k[[2, 1]], n],
> Mod[j[[1, 1]]*k[[1, 2]], n] + Mod[j[[1, 2]]*k[[2, 2]], n}},
> {Mod[j[[2, 1]]*k[[1, 1]], n] + Mod[j[[2, 2]]*k[[2, 1]], n],
> Mod[j[[2, 1]]*k[[1, 2]], n] + Mod[j[[2, 2]]*k[[2, 2]], n]}},
> n]
>
> _______________________________________________________________
>
> CPparameters := (identity = {{1, 0}, {0, 1}};
> alpha = randmatrix; Catch[Do[chi = randmatrix;
> If[mmul[chi, alpha] ! = mmul[alpha, chi],
> Throw[chi]], {10000000}]]
> chiinv = inv[chi]; alphainv = inv[alpha];
> Catch[Do[s = Random[Integer, {2, 50}];
> gamma = Mod[MatrixPower[chi, s], n];
> If[gamma != identity, Throw[gamma]], {10000000}]];
> Catch[Do[delta = Mod[Mod[Random[Integer, {1, n-1}]gamma, n]
> + Mod[Random[Integer, {1, n-1}]identity, n], n]
> If[delta !=identity &&
> mmul[delta, alpha] !=mmul[alpha, delta], Throw [delta]],
> {10000000}];
> beta = mmul[mmul[chiinv, aphainv], chi];
> deltainv = inv[delta];
> epsilon = mmul[mmul[deltainv, alpha], delta];
> kappa = mmul[mmul[deltainv, beta], delta];
> lamda = mmul[mmul[chiinv, epsilon], chi];)
>
> _______________________________________________________________
>
> CPenc[plain_String] := CPencNum [ StringToMatrices[plain]]
> _______________________________________________________________
>
> CPDecNum[l_list] := Table[mmul[mmul[lamda, l[[i]]], lamda], {i,
>Length[l]}]
> _______________________________________________________________
>
> CPEncNum[l_List] :=
> Table[mmul[mmul[kappa, l[[i]]], kappa], {i, Length[l]}]
>
>
> _______________________________________________________________
>
> CPdec[cipher_List] := MatricesToString[CPDecNum[cipher]]
>
>I will award a meaningful, albeit insignificant, prize to the first poster
>who can identify, even in broad terms, the (quite useful) function of this
>algorithm.
>
>Cary
>
>----------------------------------------------------------------------------
>--
>Archives: http://www.mail-archive.com/[email protected]/
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>
>
>
>****************************************************************************
>This e-mail is intended for the use of the addressee only. It may contain
>information that is protected by legislated confidentiality and/or is
>legally privileged. If you are not the intended recipient you are prohibited
>from disseminating, distributing or copying this e-mail. Any opinion
>expressed in this e-mail may not necessarily be that of the WorkCover
>Corporation of South Australia. Although precautions have been taken, the
>sender cannot warrant that this e-mail or any files transmitted with it are
>free of viruses or any other defect.
>If you have received this e-mail in error, please notify the sender
>immediately by return e-mail and destroy the original e-mail and any copies.
>****************************************************************************
>------------------------------------------------------------------------------
>Archives: http://www.mail-archive.com/[email protected]/
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.