## A bird is recognized by its feathers… or professional protection against spam

Often, each of us has a desire to find people similar to us (in a professional sense), but at the same time, posting your contact information on public networks can generate a lot of spam (ah, those old canned goods).

In this case, general knowledge comes to the rescue – an educational qualification in a professional field, which will not allow the “uninitiated” to use the data.

Adopt this simple personal data protection for mathematicians and programmers.

Let’s recall one of the first systems of asymmetric encryption RSA – what is its basis?

Simple fact:

if for a number **m **the known value of the Euler function **E(m)**,

then for anyone **a! = 0** is performed **a ^ E(m) % m = 1**

So, if **p** and **E(m)** are mutually simple, that is, they exist **c** and **d**such that **c*p + d*E(m) = 1**and **s = c % E(m)**

then for anyone **a** with **[0m)[0m)[0m)[0m)** is performed **a ^ (s * p) % m = a**

Take advantage of this.

We draw the program on js (I hope that those reading this in the browser know how to enter the console)

```
function split(x) {
for (let i = 2n; i * i <= x; i++) {
let j = x / i;
if (i * j == x) return [i, j];
}
}
function toPrimes(x) {
let arr = [x];
let primes = [];
while (arr.length > 0) {
let x = arr.pop();
let s = split(x);
if (s) s.forEach(y => arr.push(y));
else primes.push(x);
}
primes.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
return primes;
}
function euler(p) {
let z = 1n;
let map = new Map();
p.forEach(x => {
let value = 0n;
if (map.has(x)) { value = map.get(x); map.delete(x); }
value++;
map.set(x, value);
});
for (let [key, value] of map.entries()) {
z *= pow(key, value) - 1n;
}
return z;
}
function xgcd(a, b) {
if (!b) return [1n, 0n];
let [c, d] = xgcd(b, a % b);
let q = a / b;
return [d, c - d * q];
}
function pow(x, y) {
if (!y) return 1n;
let h = y / 2n;
let z = pow(x, h);
let r = (z * z);
if (y % 2n) r = (r * x);
return r;
}
function powmod(x, y, m) {
if (!y) return 1n;
let h = y / 2n;
let z = powmod(x, h, m);
let r = (z * z) % m;
if (y % 2n) r = (r * x) % m;
return r;
}
let p = 3n;
let q = 13n;
let m = pow(10n, q) + 1n;
let primes = toPrimes(m);
let z = euler(primes);
let primes2 = toPrimes(z);
while (primes2.find(x => x == p)) p += 2n;
let [c, d] = xgcd(p, z);
let s = c >= 0n ? c : (z + c);
function get(x) {
let t = powmod(x, s, m);
console.log(`(${t} ^ ${p}) % (10 ^ ${q} + 1) =`, powmod(t, p, m));
}
get(81234567890n);
```

We launch, check, receive

`(275491122648 ^ 7) % (10 ^ 13 + 1) = 81234567890n`

Does the English typewriter work?