# [Cryptography] Yet another dumb crypto system

Bill Cox waywardgeek at gmail.com
Wed Sep 23 17:09:52 EDT 2015

```Enjoy breaking this probably very old crypto system that was probably

Here's my dumb idea for the day: public key crypto system based on a set of
"reduction rules" applied to polynomials.  It's pretty simple.  I'm using
just 2 variables in the polynomials: x, and y, though the technique extends
to more.  The polynomials have this form:

axy + bx + cy + d

where a, b, c, and d might be 128 bit numbers modulo a 128 bit prime p.  I
want to do DH key agreement, so I want to compute

(axy + bx + cy + d)^x

for some secret x.  Multiplying this out gives larger and larger
polynomials.  One technique to keep them small is to take them modulo some
fixed polynomial.  Instead, I'm using a couple of simple "reduction
rules".  The two rules are:

x^2 => x + 3
y^2 => 2y

These rules result in a unique reduction of any polynomial of x and y with
integer coefficients to the form axy + bx + cy +d.  The "addition
operator", which is really multiplication, is computed this way:

(a x y + b x + c y + d) (e x y + f x + g y + h)
= dexy + bex^2y + cexy^2 + aex^2y^2 + dfx + bfx^2 + cfxy + afx^2y + dgy
+ bgxy + cgy^2 + agy^2x + dh + bhx + chy + ahxy
Now apply reductions
= dexy + be(x+3)y + 2cexy + 2ae(x+3)y + dfx + bf(x+3) + cfxy + af(x+3)y
+ dgy + bgxy + 2cgy + 2agyx + dh + bhx + chy + ahxy
= dexy + bexy + be3y + 2cexy + 2aexy + 2ae3y + dfx + bfx + bf3 + cfxy +
afxy + af3y + dgy + bgxy + 2cgy + 2agyx + dh + bhx + chy + ahxy
= dexy + bexy + 3bey + 2cexy + 2aexy + 6aey + dfx + bfx + 3bf + cfxy +
afxy + 3afy + dgy + bgxy + 2cgy + 2agyx + dh + bhx + chy + ahxy
= xy(de + be + 2ce + 2ae + cf + af + bg + 2ag + ah) + x(df + bf + bh) +
y(3be + 6ae + 3af + dg + 2cg + ch) + (3bf + dh)

This gives the formulas for new coefficients A, B, C, and D, in terms of a,
b, c, d, e, f, g, and h:

A = (d*e + b*e + 2*c*e + 2*a*e + c*f + a*f + b*g + 2*a*g + a*h) % p
B = (d*f + b*f + b*h) % p
C = (3*b*e + 6*a*e + 3*a*f + d*g + 2*c*g + c*h) % p
D = (3*b*f + d*h) % p

With this addition rule, I can define multiplication in the usual way, and
use it for DH key agreement.  The identity element is (0, 0, 0, 1) meaning
a = 0, b = 0, c = 0, and d = 1.

The resulting groups have cycle lengths up to p^2 - 1.  Are prime power
sized groups as secure as groups with prime size?  If so, and with the
wildly optimistic assumption that this dumb scheme has bit security equal
to sqrt(group size), then just maybe using 128 bit values for A, B, C, and
p result in 128-ish bits of security.  Probably not, though :)

Partially, the motivation here is to include elements of add-xor-rotate
hash functions.  The x^2 => (x + 3) reduction rule creates terms that
combine with the constant term, sort of simulating right shift  Without it,
the constant term is just d^x mod p, which is too easy to break.  The
multiplications give an addition-like mixing from lower to higher order
terms, while truncating the exponents seems to give me non-linearity like I
get with XOR.  If these function as I hope, the output bits (the
coefficients a, b, c, and d) should be uniformly pseudo-random and resist
analysis.

I've attached some hacked up Python code.

Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.metzdowd.com/pipermail/cryptography/attachments/20150923/19ec6a9b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reduce_dh.py
Type: text/x-python
Size: 1866 bytes
Desc: not available
URL: <http://www.metzdowd.com/pipermail/cryptography/attachments/20150923/19ec6a9b/attachment.py>
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.7935796,"math_prob":0.99830014,"size":3703,"snap":"2022-05-2022-21","text_gpt3_token_len":1238,"char_repetition_ratio":0.10516356,"word_repetition_ratio":0.08412483,"special_character_ratio":0.34593573,"punctuation_ratio":0.120667525,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99744844,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-26T01:48:54Z\",\"WARC-Record-ID\":\"<urn:uuid:0257283d-690d-465a-98c7-685fe2a0bfcd>\",\"Content-Length\":\"6742\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ac51e59b-600a-4067-9159-e91ab1956faf>\",\"WARC-Concurrent-To\":\"<urn:uuid:2016fc38-ea73-4506-9bfa-21d26a00ae60>\",\"WARC-IP-Address\":\"166.84.7.15\",\"WARC-Target-URI\":\"https://www.metzdowd.com/pipermail/cryptography/2015-September/026561.html\",\"WARC-Payload-Digest\":\"sha1:RYWYJGQEZKKRFNS37MQ2SALRYZ6OVSJ5\",\"WARC-Block-Digest\":\"sha1:6HM6XWCBHWST7A2XB3EJ447EKTTZBC36\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662595559.80_warc_CC-MAIN-20220526004200-20220526034200-00580.warc.gz\"}"}