0

I'm using Basic JavaScript BN library (jsbn.js) https://github.com/travist/jsencrypt/tree/master/lib/jsbn

var modulus = "afb0c9dc2e903714fd3e4bd2965efc2c3a995fe52484527113a20bf5d4754fac141678aaace845500175771fe98d23ae1cbd75bc51a5252fa685c118dd6f488ec3f23b35ab1ecf2d7f490a2902076a22be0e6e24ea5e70dca6d94e2ac847e41518a6a8c89a70d9d160e97f80cb9a26248c36207a32a652bf7af73bf8144040f3d8c6f66c5d1ce6944d5283e9133ed44dcc797322ff6790895d4cb993eddb55831ffe61513952fec0d341077bd79a14836cad5d5a774f87b886ac9886d2c1bfdfbd024c398c645ea81ccb5990c127005a8c2bbeb9bacafed13de29ae43b4ac2467e0f19dc1bb0fb47bce6d122adf1346aad261a29cbc65e942c3387a274075441";
var modulus_bi = new BigInteger(modulus, 16);
console.log(modulus_bi);
console.log(''+ modulus_bi)

This code drawing in browser console:

BigInteger {0: 67589185, 1: 54032935, 2: 106861612, 3: 27434172, 4: 74100006, 5: 36364051, 6: 129820369, 7: 29036468, 8: 235870684, 9: 78390375, 10: 43705403, 11: 267195358, 12: 247053002, 13: 94945979, 14: 12658432, 15: 30193049, 16: 207904424, 17: 2409368, 18: 29351869, 19: 159935788, 20: 129533612, 21: 94860536, 22: 57453917, 23: 226074952, 24: 54593403, 25: 87026701, 26: 241258809, 27: 89666047, 28: 160689627, 29: 144037067, 30: 50292624, 31: 214406962, 32: 54449229, 33: 86523537, 34: 216437837, 35: 258393553, 36: 15980742, 37: 260129796, 38: 259716923, 39: 53110059, 40: 204873850, 41: 161636936, 42: 159350987, 43: 228398606, 44: 147364464, 45: 22121066, 46: 180897764, 47: 174953698, 48: 173961436, 49: 15131214, 50: 124396222, 51: 10653728, 52: 254639945, 53: 56275436, 54: 247722555, 55: 232191112, 56: 109429016, 57: 173167354, 58: 225819729, 59: 37413323, 60: 119531917, 61: 83892055, 62: 179103813, 63: 21063562, 64: 74796972, 65: 169918301, 66: 72511763, 67: 100553288, 68: 204225177, 69: 220816879, 70: 83705419, 71: 48825201, 72: 263244252, 73: 10, t: 74, s: 0}

22178881035435756104631685495040204339664209418638170616423936407119808718378245425796413374894028242173005218859832036364449053364286492477084141355875231111026874222360802753594335365006250663003116748185664896637209138784121256193558985361096984594251703173226242989269400838202290484202511917234676483547969915122695899979926552724765662201462222689893361923431739514352195381645622412150962568584848018399101493841119161227529561998997907886533637937861400081638773709699624572484164992881472424925539124746334682749260371386441252205880190246876646829680029471729930571363064027773445349555654612081622601126977

Question: Tell me what is the a groups of digits in first variant? And how I can convert manualy first variant to second in PHP?

=======================================================

Once again:

I have array of 32-bit unsigned integers in PHP:

Array
(
    [t] => 74
    [s] => 0
    [0] => 67589185
    [1] => 54032935
    [2] => 106861612
    [3] => 27434172
    [4] => 74100006
    [5] => 36364051
    [6] => 129820369
    [7] => 29036468
    [8] => 235870684
    [9] => 78390375
    [10] => 43705403
    [11] => 267195358
    [12] => 247053002
    [13] => 94945979
    [14] => 12658432
    [15] => 30193049
    [16] => 207904424
    [17] => 2409368
    [18] => 29351869
    [19] => 159935788
    [20] => 129533612
    [21] => 94860536
    [22] => 57453917
    [23] => 226074952
    [24] => 54593403
    [25] => 87026701
    [26] => 241258809
    [27] => 89666047
    [28] => 160689627
    [29] => 144037067
    [30] => 50292624
    [31] => 214406962
    [32] => 54449229
    [33] => 86523537
    [34] => 216437837
    [35] => 258393553
    [36] => 15980742
    [37] => 260129796
    [38] => 259716923
    [39] => 53110059
    [40] => 204873850
    [41] => 161636936
    [42] => 159350987
    [43] => 228398606
    [44] => 147364464
    [45] => 22121066
    [46] => 180897764
    [47] => 174953698
    [48] => 173961436
    [49] => 15131214
    [50] => 124396222
    [51] => 10653728
    [52] => 254639945
    [53] => 56275436
    [54] => 247722555
    [55] => 232191112
    [56] => 109429016
    [57] => 173167354
    [58] => 225819729
    [59] => 37413323
    [60] => 119531917
    [61] => 83892055
    [62] => 179103813
    [63] => 21063562
    [64] => 74796972
    [65] => 169918301
    [66] => 72511763
    [67] => 100553288
    [68] => 204225177
    [69] => 220816879
    [70] => 83705419
    [71] => 48825201
    [72] => 263244252
    [73] => 10
)

This array is internal representation of BigInteger in JavaScript. I need to convert this array IN PHP to:

22178881035435756104631685495040204339664209418638170616423936407119808718378245425796413374894028242173005218859832036364449053364286492477084141355875231111026874222360802753594335365006250663003116748185664896637209138784121256193558985361096984594251703173226242989269400838202290484202511917234676483547969915122695899979926552724765662201462222689893361923431739514352195381645622412150962568584848018399101493841119161227529561998997907886533637937861400081638773709699624572484164992881472424925539124746334682749260371386441252205880190246876646829680029471729930571363064027773445349555654612081622601126977

How I can do this convert operation? IN PHP?

  • I'm not familiar with this library, but I think the first set of numbers is a dumping of the raw storage components that comprise the `BigInteger`'s internal representation (looks like an array of 32-bit unsigned integers). – Dai Feb 14 '17 at 21:24
  • PHP does not have native support for big-integers. You will need a third-party library: http://stackoverflow.com/questions/4427020/is-there-a-biginteger-class-in-php – Dai Feb 14 '17 at 21:25
  • **Dai** thank you, maybe are you right. Do you have any ideas, how I can convert this array of 32-bit unsigned integers to second variant representation ? – Evgeny Zimin Feb 14 '17 at 21:35
  • **Dai**, yes I know about many BigInteger libraries for PHP, but my problem is in the other. I have array of 32-bit unsigned integers in PHP, and I need get second representation of this BigInteger value in PHP Array ( [0] => 67589185 [1] => 54032935 [2] => 106861612 [3] => 27434172 [4] => 74100006 [5] => 36364051 [6] => 129820369............... [70] => 83705419 [71] => 48825201 [72] => 263244252 [73] => 10 ) – Evgeny Zimin Feb 14 '17 at 21:38
  • To confirm, you want to pass a JavaScript big-integer to PHP? – Dai Feb 14 '17 at 22:37
  • No ) I have array of 32-bit integers IN PHP, this array is internal representation of BIgInteger for JavaScript. And I need to convert this array to second variant (in my first message) in PHP – Evgeny Zimin Feb 15 '17 at 07:33

0 Answers0