Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Cryptography indexing the hash and primeality testing

  1. Mar 7, 2015 #1
    +David West

    Heres What I got as far as the hash is concerned.
    Heres my indexing functions

    First We Have this fucntion for fast indexing of the hash.

    ZequebaHashB[bvc_, yvc_, avc_] :=
    {Drop[Flatten[Reap[
    Module[{a34 = bvc, a35 = yvc, rt2 = avc, z75, zler},
    z75 = 1;
    zler = Total[BCC[Re[Floor[Px[a34, a35^2]]], a35^3]];
    Label[Start5629];
    Sow[Denominator[zler/FiveItt[a35, z75]], yvc];
    z75 = z75 + 1;
    If[z75 >= rt2 + 1, Goto[end5629]];
    Goto[Start5629];
    Label[end5629];
    ];]], 1], Total[BCC[Floor[Re[Px[bvc, yvc^2]]], yvc^3]], bvc};


    Second we have this function for Getting a Rainbow Index of the hash


    RainbowHashXG[zf_, xz_, zd_, fd_] :=
    Column[{Table[
    Flatten[Drop[ZequebaHashB[RS[zf, 5] + xf, xz, zd], -2]], {xf, 0,
    fd - 1}], zf}];

    Now When you try these functions

    Table[ZequebaHashB[Hash[xu, "SHA512"], 2, 5], {xu, 1, 10}]

    {{{1, 2, 3, 4, 5}, 427,
    12579926171497332473039920596952835386489858401292624452730263741969\
    1347390182282976402981790496477460666208142347425205936701161323553455\
    43156774710409041},
    {{1, 1, 1, 1, 5}, 396,
    37854471215291391986149267401049113295567628473597440675968265868739\
    3920246834469920751231286910611366704757913119360843344094113813460828\
    6029275267369625},
    {{1, 1, 1, 2, 5}, 378,
    71668700870008575285238318023246235316098096074289026150051114683524\
    8893999285271969471146596174190457020264703584540790263678736452792747\
    5984118971455163},
    {{1, 2, 3, 4, 5}, 377,
    33095966240281217830184164668404219514626500609945265788213543056523\
    6612792119604718913684957565086394439681603253709963629672412822522528\
    4694992131191098},
    {{1, 2, 1, 4, 5}, 363,
    86087420302049294430262146818103852368792727362988712093781053088200\
    5531339261473092981846995901587757487311471069416835834626804973821926\
    684090578667825},
    {{1, 1, 3, 2, 5}, 374,
    18586086601485268646467765285794047467027639305129763019055665664163\
    2819380637531124748570695025942793945139516664108034654512831533948189\
    743738184270224},
    {{1, 1, 3, 1, 1}, 380,
    72109882448403363840259529414390721196358024901859951350044294221621\
    3409708767088486766304397692430037767785681544787701437132358156239382\
    5256452011168475},
    {{1, 2, 3, 4, 5}, 397,
    22760214977694020069971224118591466739483553732805530503408373418535\
    1711847169063849360187954434350675389187296376543635586233555068331343\
    3001046271103001},
    {{1, 2, 1, 4, 5}, 369,
    11906459655144790308170064541982556680120578173098014909650827827844\
    2313493552143468785692756291539132782149145837942478466345517803751070\
    21641806135272354},
    {{1, 1, 3, 2, 5}, 382,
    88155955858214177781767282869972903505820511583564376117417944351446\
    8458315518532665921338085983977628624644833036888032312932654944528755\
    5410805140620789}}


    Table[RainbowHashXG[Hash[xu, "SHA512"], 2, 5, 5], {xu, 1, 10}]

    {{{{1, 1, 1, 1, 5}, {1, 2, 3, 4, 5}, {1, 1, 3, 2, 5}, {1, 2, 1, 4, 1}, {1, 1, 3, 1, 5}},
    12579926171497332473039920596952835386489858401292624452730263741969\
    1347390182282976402981790496477460666208142347425205936701161323553455\
    43156774710409041},
    {{{1, 2, 1, 4, 5}, {1, 1, 3, 2, 5}, {1, 2, 3, 4, 1}, {1, 1, 1, 1, 5}, {1, 2, 3, 4, 5}},
    37854471215291391986149267401049113295567628473597440675968265868739\
    3920246834469920751231286910611366704757913119360843344094113813460828\
    6029275267369625},
    {{{1, 2, 3, 4, 5}, {1, 1, 1, 1, 5}, {1, 2, 3, 4, 5}, {1, 1, 3, 2, 5}, {1, 2, 1, 4, 1}},
    71668700870008575285238318023246235316098096074289026150051114683524\
    8893999285271969471146596174190457020264703584540790263678736452792747\
    5984118971455163},
    {{{1, 2, 3, 4, 5}, {1, 1, 1, 1, 5}, {1, 2, 3, 4, 5}, {1, 1, 3, 2, 1}, {1, 2, 1, 4, 5}},
    33095966240281217830184164668404219514626500609945265788213543056523\
    6612792119604718913684957565086394439681603253709963629672412822522528\
    4694992131191098},
    {{{1, 2, 3, 4, 1}, {1, 1, 3, 1, 5}, {1, 2, 1, 4, 5}, {1, 1, 3, 2, 5}, {1, 1, 3, 1, 5}},
    86087420302049294430262146818103852368792727362988712093781053088200\
    5531339261473092981846995901587757487311471069416835834626804973821926\
    684090578667825},
    {{{1, 1, 1, 1, 5}, {1, 2, 3, 4, 5}, {1, 1, 3, 2, 5}, {1, 2, 1, 4, 1}, {1, 1, 3, 1, 5}},
    18586086601485268646467765285794047467027639305129763019055665664163\
    2819380637531124748570695025942793945139516664108034654512831533948189\
    743738184270224},
    {{{1, 2, 3, 4, 1}, {1, 1, 1, 2, 5}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5}, {1, 1, 3, 2, 5}},
    72109882448403363840259529414390721196358024901859951350044294221621\
    3409708767088486766304397692430037767785681544787701437132358156239382\
    5256452011168475},
    {{{1, 1, 3, 1, 5}, {1, 2, 3, 4, 1}, {1, 1, 1, 2, 5}, {1, 2, 3, 4, 5}, {1, 1, 3, 1, 5}},
    22760214977694020069971224118591466739483553732805530503408373418535\
    1711847169063849360187954434350675389187296376543635586233555068331343\
    3001046271103001},
    {{{1, 1, 1, 2, 5}, {1, 2, 3, 4, 5}, {1, 1, 3, 1, 1}, {1, 2, 1, 4, 5}, {1, 2, 1, 4, 1}},
    11906459655144790308170064541982556680120578173098014909650827827844\
    2313493552143468785692756291539132782149145837942478466345517803751070\
    21641806135272354},
    {{{1, 2, 1, 4, 5}, {1, 1, 3, 1, 1}, {1, 2, 3, 4, 5}, {1, 1, 1, 2, 5}, {1, 2, 3, 4, 5}},
    88155955858214177781767282869972903505820511583564376117417944351446\
    8458315518532665921338085983977628624644833036888032312932654944528755\

    Heres what I have regarding primality testing It seems If I can kind of tell if a number is a composite or prime very Quickly once I've done some more tweaking and not only that differnt types of composites seem to yeild different behavours too. I might be very close to fast prime factorisation or at least a very fast probable prime test that can even be done quickly on numbers with 100's of millions of digits long evn a billion digits long quickly with a good GPU once coded properly for.

    The Results
    First
    Comparing Primes with Compisites

    {{{0, -2, 0, 2}, {0, 0, 0, 1,0}}, {{-2, 0, 1, -1}, {0, 0, 1, 1, 0}}},
    {{{-2, 0, 2, 0}, {0, 0,0, 0, 0}}, {{0, 2, 0, 0}, {0, 0, 1, 1, 0}}},
    {{{0, -2, 0, 2}, {0, 0, 0, 0, 0}}, {{2, 0, 1, -1}, {0, 0, 1, -1, -1}}},
    {{{2, 0, 0,2}, {0, 0, 0, 0, 0}}, {{0, 2, 0, 2}, {0, 0, -1, -1,0}}},
    {{{0, -2, 2, 0}, {0, 0, 1, 0, 0}}, {{0, -2, -2, 0}, {0, 0,0, 1, 0}}},
    {{{-2, 0, 2, 0}, {0, 0, 0, 0, 0}}, {{2, 0, 0, 0}, {0, 0, 1, -1, 0}}},
    {{{2, 0, 0, -2}, {0, 0, 0, 0, 0}}, {{0, 2, 1,1}, {0, 0, -1, 1, 0}}},
    {{{2, 0, 2, 0}, {0, 0, 0, 1, 0}}, {{0, 2, 1, 1}, {0, 0, 1, 1, 0}}},
    {{{0, -2, 2, 0}, {0, 0, 0, 0, 0}}, {{-2, 0, 1, -1}, {0, 0, -1, 0, 0}}},
    {{{0, 2, 0, 2}, {0, 0, 0, 1, 1}}, {{0, 2, 1, -1}, {0, 0, 1, 1, 0}}}

    Now Comparing 3 Prime Composites with 2 Prime Composites
    {{{0, 2, 0, -2}, {-1, -1, 1, 0, 1}}, {{0, 2, 2, 0}, {-1, 1, -1, 0, 0}}},
    {{{2, 0, 0, -2}, {0, -1, 0, 0, -1}}, {{0, 2, 2, 0}, {-1, -1,1, 0, 0}}},
    {{{0, -2, 0, -2}, {0, 0, 0, 0, 1}}, {{-2, 0, 2, 0}, {1, 0, -1, 1, 0}}},
    {{{-2, 0, 2, 0}, {1, 0, 0, 0, 0}}, {{0, -2, -2, 0}, {0, 0, -1, 1, 0}}},
    {{{2, 0, 0, -2}, {1, 1, -1, 0, -1}}, {{0,2, 2, 0}, {0, -1, -1, -1, 0}}},
    {{{-2, 0, -2, 0}, {-1, 0, 0, 0, 0}}, {{0, -2, 0, 2}, {0, 0, 1, 0, 0}}}

    Now the MatheMatica Code I used

    FiveItt[x98_, cc5_] :=
    DifferenceRoot[
    Function[{\[FormalY], \[FormalN]}, {-cc5 -
    cc5 \[FormalY][\[FormalN]] + \[FormalY][1 + \[FormalN]] ==
    0, \[FormalY][1] == 1, \[FormalY][2] == cc5}]][x98];

    BCC[x55_, g77_] :=
    Drop[Flatten[Reap[
    Module[
    {x45 = x55, z7 = 0, z8 = 0, z9, g7 = g77, bell},

    z7 =
    If[x45/FiveItt[Length[IntegerDigits[x45, g7]], g7] <= 1,
    If[x45 == 1, 1, Length[IntegerDigits[x45, g7]] - 1],
    Length[IntegerDigits[x45, g7]]];
    bell = FiveItt[z7 - 1, g7];
    z9 = g7^(z7 - 1);

    Label[SPo];
    z8 =
    If[IntegerQ[x45/g7] && x45 > g7,
    Quotient[x45 - bell - (1/(2*g7)), z9],
    If[x45 <= g7, x45, Quotient[x45 - bell, z9]]];
    Sow[z8];
    x45 = x45 - (z8*(z9));
    z7 = z7 - 1;
    z9 = z9/g7;
    bell = bell - z9;

    If[z7 < 1, Goto[EnD], Goto[SPo]];

    Label[EnD];

    ]
    ]], 1];

    Px = Compile[
    {{x1d, _Complex}, {si1d, _Real}}
    ,
    Module[{x1c = x1d, si1c = si1d}
    , x1c +
    1/2 (Floor[
    Re[(-4 + si1c +
    Sqrt[(-4 + si1c)^2 + 8 (-2 + si1c) (-1 + x1d)])/(
    2 (-2 + si1c))]] +
    Floor[Im[(-4 + si1c +
    Sqrt[(-4 + si1c)^2 + 8 (-2 + si1c) (-1 + x1d)])/(
    2 (-2 + si1c))]] I) (-4 +
    si1c - (-2 +
    si1c) (Floor[
    Re[(-4 + si1c +
    Sqrt[(-4 + si1c)^2 + 8 (-2 + si1c) (-1 + x1c)])/(
    2 (-2 + si1c))]] +
    Floor[Im[(-4 + si1c +
    Sqrt[(-4 + si1c)^2 + 8 (-2 + si1c) (-1 + x1c)])/(
    2 (-2 + si1c))]] I))]
    , CompilationTarget -> "C", "RuntimeOptions" -> "Speed"];

    PJ[x45_] := {
    {
    JacobiSymbol[x45, Floor[Re[Px[Total[BCC[x45, 5]], 11]]]] +
    JacobiSymbol[x45, Floor[Re[Px[Total[BCC[x45, 11]], 5]]]],
    JacobiSymbol[x45, Floor[Re[Px[Total[BCC[x45, 5]], 11]]]] -
    JacobiSymbol[x45, Floor[Re[Px[Total[BCC[x45, 11]], 5]]]],
    JacobiSymbol[x45, Floor[Re[Px[x45, 7]]]] +
    JacobiSymbol[x45, Floor[Re[Px[x45, 5]]]],
    JacobiSymbol[x45, Floor[Re[Px[x45, 7]]]] -
    JacobiSymbol[x45, Floor[Re[Px[x45, 5]]]]
    }, {
    JacobiSymbol[x45 + 5, Floor[Re[Px[x45, 11]]]],
    JacobiSymbol[x45 + 5, Floor[Re[Px[x45, 5]]]],
    JacobiSymbol[x45 + 5, Floor[Re[Px[Total[BCC[x45 + 5, 5]], 5]]]],
    JacobiSymbol[x45 + 5, Floor[Re[Px[Total[BCC[x45 + 5, 5]], 11]]]],
    JacobiSymbol[x45 + 5, Floor[Re[Px[Total[BCC[x45 + 5, 11]], 5]]]]
    }
    };.
     
  2. jcsd
  3. Mar 12, 2015 #2
    Thanks for the post! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post?
     
  4. Mar 12, 2015 #3
    My
    My main computer's down at the moment but I should have at least have a
    fast probable prime test code in a few weeks. I will try and rewrite in latex then. Sorry got hacked got fustrated and well.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Cryptography indexing the hash and primeality testing
  1. Indexes in Mathematica (Replies: 4)

Loading...