17
$\begingroup$

Introducing a super secure function to crypt your sensitive data - PolynumCrypt!

Say you wanted to crypt the string $\text{super}$, with a key of $6$.

  • Get the ASCII values of the string, corresponding to $115,117,112,101,114$ in this case
  • Turn that into a polynomial where the $n\text{th}$ coefficient corresponds to the $n\text{th}$ ASCII value, in this case $115x^4 + 117x^3 + 112x^2 + 101x + 114$
  • Substitute the key value into $x$ to get your crypted number, in this case $179064$.

I've written a Python script to make it easy to use.

Of course, brute-forcing $256^{n}$ possibilities for a string length $n$ is impossible, which makes this algorithm super secure.

Maybe you can prove me wrong about PolynumCrypt, if you can crack my password:

$\text{polynumcrypt(pass,1) = 1253}$
$\text{polynumcrypt(pass,1253) = 2102474472933529067195268690993346961762041}$

$\endgroup$
  • 1
    $\begingroup$ Is pass a variable or a string? $\endgroup$ – March Ho Mar 24 '15 at 7:55
  • 3
    $\begingroup$ By the way this is not an encryption but a hash. An encryption should have unique results and be reversible. this isn't the case. $\endgroup$ – Ivo Beckers Mar 24 '15 at 8:07
  • 1
    $\begingroup$ A hash is fixed length. This isn't a hash. I also tried to use the word 'crypt' instead of encrypt because I realize it isn't reversible, but I'm all ears if you have a better word. $\endgroup$ – Tryth Mar 24 '15 at 8:09
  • 4
    $\begingroup$ @IvoBeckers Actually, if x > 255 then, this is quite reversible, is it not? $\endgroup$ – dmg Mar 24 '15 at 8:11
  • 2
    $\begingroup$ Assuming the key is unknown, however, this is actually a workable little sister encryption mechanism. $\endgroup$ – March Ho Mar 24 '15 at 8:15
20
$\begingroup$

We don't need to brute-force $256^n$ possibilities – since the overly large number is written in base $1253$ (that's what the polynomial is for) and ASCII characters are at most $128$, we can just express the large number in base $1253$ and extract the digits exactly as is.

Wolfram Alpha gives a decomposition of 112:48:108:121:110:111:109:49:64:108:115:46:83:69. These ASCII values then evaluate to: p0lynom1@ls.SE

$\endgroup$
  • $\begingroup$ This is far more elegant than my answer. +1 $\endgroup$ – March Ho Mar 24 '15 at 8:10
  • 3
    $\begingroup$ I misread @ as A when first solving this problem. This sort of password is hard to remember and easy to get wrong. Remember to always correct horse battery staple your passwords, kids! $\endgroup$ – Joe Z. Mar 24 '15 at 21:30
8
$\begingroup$

Is it?

p0lynom1@ls.SE

How?

Modulo the encrypted password by 1253 results in the last character. Divide it by 1253 and repeat and you get all characters.

$\endgroup$
  • $\begingroup$ Beat you to the punch by 10 seconds. $\endgroup$ – Joe Z. Mar 24 '15 at 8:07
  • 1
    $\begingroup$ @JoeZ. But your initial answer was wrong. Too bad first edits don't show :D $\endgroup$ – dmg Mar 24 '15 at 8:08
  • $\begingroup$ It's not my fault that @ and A are right next to each other in the ASCII table! D: $\endgroup$ – Joe Z. Mar 24 '15 at 8:08
  • $\begingroup$ :D Either way, good show! Should I delete this or something? $\endgroup$ – dmg Mar 24 '15 at 8:10
  • $\begingroup$ Nah, I already upvoted it. In any case your solution is slightly different from mine, and so is March Ho's. $\endgroup$ – Joe Z. Mar 24 '15 at 8:11
5
$\begingroup$

The first character of the string has the highest power, therefore it will dominate the polynomial.

Dividing the number by (1253^13) results in 112 (p)

The remainder of the division can be fed back into the calculation, finally resulting in the plaintext

p0lynom1@ls.SE

The Mathematica code used to generate the answer:

string = "";
inNum = 2102474472933529067195268690993346961762041;
pow = 13;
While[pow >= 0, charfloat = N[inNum/(1253^pow)];
  charint = Floor[charfloat];
  string = string <> FromCharacterCode[charint];
  inNum = inNum - charint*(1253^pow);
  pow = pow - 1;];
string
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.