1

I have discovered that Diffie Hellman(DH)shared key is unequal in Apple Numbers, Google Sheets, and Mac Excel (2008).

In Section 1.0, the first try at a solution uses a small Prime to produce certain ranges in the above applications where the parameters either create unequal shared keys or return errors.

In Section 2.0, the second try at a solution using larger Primes produces similar ranges where the parameters either crate unequal shard keys or return errors. The explanation is that each application has upper limits on computing modulo math.

In Section 3.0, there is a request for a work around for the typical user so that reliable DH shared keys can be calculated.

So here is my question as quoted on the final line of this post:

So, does anyone have a suggestion as to how to not use the most common spreadsheets to calculate DH values?

1.0 FIRST TRY TO FIND A SOLUTION

The first try at a solution produced errors when the shared secret key was not equal or when there was a crash such that an error was returned.

1.1 FIRST EXAMPLE

For instance, these values compute the same value for Alice's and Bob's shared key.

P (Prime) = 11

g (primitive root) = 7

A (Alice's public key) = 10

B (Bob's public key) = 4

a (Alice's private key)= 1

b (Bob's private key) = 3

S (Alice's shared key) = 1

s (Bob's shared key) = 1

1.2 FIRST EXAMPLE ERRORS

However, ranges of Alice's public key creates equal shared keys, but crash after certain upper limits or provides different values for shared keys.

For instance, Apple Numbers creates equal shared keys(S,s)for Alice's public key from 1 to 17. After that range, the application creates unequal shared keys.

Similarly, Google Sheets creates equal shared keys (S,s) for Alice's public key from 1 to 15. After that range, the application returns an #NUM! error.

Also, Excel (Mac 2008) creates creates equal shared keys (S,s) for Alice's public key from 1 to 10. After that range, the application returns a #NUM! error.

1.3 FIRST POTENTIAL EXPLANATION

There is a passing reference to on the Diffie-Hellman Key Exchange Wikipedia page (https://en.wikipedia.org/wiki/Diffie–Hellman_key_exchange) that states:

Here is a more general description of the protocol:

  1. Alice and Bob agree on a natural number n and a generating element g in the finite cyclic group G of order n. (This is usually done long before the rest of the protocol; g is assumed to be known by all attackers.) The group G is written multiplicatively.

  2. Alice picks a random natural number a with 1 < a < n, and sends the element ga of G to Bob.

  3. Bob picks a random natural number b with 1 < b < n, and sends the element gb of G to Alice.

  4. Alice computes the element (gb)a = gba of G.

  5. Bob computes the element (ga)b = gab of G.

Note closely above quoted passages number as 2. and 3.

Here is the significant passage: "1 < a < n" such a = Alice's private key and n = P (the Prime as referenced in this post). So, the answer might be that once the a is greater than 11, then we get answers which are not always correct.

2.0 SECOND TRY TO FIND A SOLUTION

The second try used a much large P, but received similar errors.

2.1 SECOND EXAMPLE

However, let us consider another example (computed in Google sheets) where P is equal a very large number (P = 883) with a large number values of g being primitive roots.

P (Prime) = 883

g (primitive root) = 7

A (Alice's public key) = 10

B (Bob's public key) = 5

a (Alice's private key)= 17

b (Bob's private key) = 30

S (Alice's shared key) = 876

s (Bob's shared key) = 876

2.3 SECOND POTENTIAL EXPLANATION

No doubt, the peculiarity of each application provides different answers based on how modulo math is computed with large numbers.

The results is that we get either unequal shared keys or crashes when ranges of a are computed only within certain ranges.

Apple Numbers have equal shared keys when a varies from 1 to 12;

Google sheets work have equal shared keys when a varies from 1 to 10;

Excel (Mac 2008) does not have equal shared keys when a varies from 1 to 12.

3.0 WHAT WORKS FOR THE TYPICAL USER?

My question then is what application is the work around for typical users.

Perhaps, there is an online web pages that computes values in a language that does not create errors as described in this post.

Maybe, there is an app. I do not find apps on the Apple App Store with Diffie Hellman as a search term.

Perhaps there is a plug-in for browsers.

So, does anyone have a suggestion as to how to not use the most common spreadsheets to calculate DH values?

1
  • You want to know how to calculate values? That's not a security question. And people who need to do this use programs or scripts. Try Python.
    – schroeder
    May 4 at 17:18

0

Browse other questions tagged .