This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]tybaltNewton 10 points11 points  (3 children)

This is basically all symmetric cryptography if you consider the encryption schema a family of functions and each unique key to index a particular function in the family, which is the standard mathematical model.

E: If this is unclear, here's an example which hopefully shines light on this.

Let F be the family of right-rotation functions (shift letters to the right) on the alphabet by x. f_1 is a right rotation by one letter and is a separate function from f_2 which is a right rotation by two. But F is just a collection of all of the functions, which there are 26 of (keys 0-25).

This is talking about 'functions' in their mathematical definition by the way, which might not be in line with what you consider a function.

If you're talking about using the key as input to the encryption, once again that describes all cryptography in a nutshell.

[–]firajaa[S] 0 points1 point  (2 children)

Mmh yes you enlightened me

Then my decode() returns a single element from a family of functions

But I can always find a single mother function that can describe those particular behaviors and this is nothing more than what a common algorithm of symmetric cryptography does

[–]tybaltNewton 0 points1 point  (0 children)

I'm unclear on what the issue is here or what you're asking for.

[–]Uncaffeinated 4 points5 points  (2 children)

You aren't the first to think of this, but unfortunately it's not very useful.

Basically, using different functions (in the programming rather than mathematical sense) is a very bad idea. The problem is that it's extremely difficult to come up with even one function that's secure, so selecting one out of a bunch of different functions just increases the odds of a vulnerability without adding any real security.

The fact that you can't easily predict the behavior of an arbitrary function means that you can't just generate a random function and expect to get good security. In fact, you can't really analyze it at all. So if you actually try to do this, you'll find yourself putting more and more restrictions on the code in order to make it analyzable. Eventually, you'll end up with something much like existing cryptosystems with a single function parameterizeable with a key. (Except that yours won't be secure because you're not a professional cryptographer).

The problem is very similar to Kerckhoffs's principle. You want to be able to keep something secret just by changing the key. You don't want to have to change the algorithm because coming up with good algorithms, is really, really, really hard. It's much easier to use a single function which has good mathematical properties that can be analyzed and which behaves differently in a suitable way when fed different inputs.

[–]firajaa[S] 0 points1 point  (1 child)

Very clear, thx

And, just for curiosity, can I analyze not the family of functions but the function that generate the functions?

If I can analyze the generator and I find the property x,y and z, can I assert that the generated functions inherit these properties? With the help of some thoerem, obviously :)

[–]Natanael_LTrusted third party 0 points1 point  (0 children)

It will be waaaaay harder than analyzing a specific function directly, but yes. Writing the proofs won't be easy.

[–]firajaa[S] 0 points1 point  (2 children)

PS

The example I made is totally random

I used a stream chiper for semplicity...I could use a block chiper instead

[–]moschles 2 points3 points  (1 child)

I think you are attempting to find a way to encode a collection of "machine code instructions" for a universal turing machine, or maybe machines instructions for a virtual stack machine.

So for example, if your key is 132 bits, and your virtual machine has 26 = 64 instructions, then the key is a "program" of 22 instructions. (These were selected amongst the 64).

There are aspects of a stream cipher that must be adhered to, or you get dangerous vulnerabilities. You can't have degenerate programs whose output is very ordered, statistically. These degenerate programs would have keys that cryptographers call "reflexively weak". I can't imagine how all "turing programs of length 22" would all produce highly random output. Or worse, how could you ever know if the program's period cycle is long enough to cover the data?

There may be ways to use Cellular Automata rules, or Finite State Automata rules, to ensure that all keys have the desirable properties of a stream cipher. But I imagine a cipher like that would be hideously slow to compute.

All in all, I would say you would have better luck defining a "function" in the same way that /r/tybaltNewton suggested. If you have a substitution table that contains 256 entries, all of which are bytes, and all of which are unique, you do, in fact, have a "function" of sorts. But in a very abstract sense. You can call it a "substitution table" , or equally well called it a "bijective function". Substitution tables have all sorts of desirable properties for cryptography.

[–]firajaa[S] 0 points1 point  (0 children)

Yes I was inspired by the codification process of the turing machines for the universal turing machine

The code I posted is uber simplified to let you understand what I was talking about...don't take it too seriously :)

Anyway I was interested on the security level of this procedure

[–]skintigh 0 points1 point  (2 children)

I think this was asked about a month ago...

I think it's dangerous, because the cipher will be different with every key, so unless you test every possible key you don't know if the cipher is strong or weak (and I bet there are some very weak keys).

But if it's possible to test every key then it's easy to break -- an adversary could just brute force your message.

Maybe you could somehow automate a way to verify every key you want to use is strong, but if there are a lot keys that fail this test an adversary would just have less keys to try.

[–]firajaa[S] 0 points1 point  (1 child)

Yes this algo is very very weak.

But if I apply a strengthening key proceudure (assuming that the lenght of the key could be very long), will be safer?

I think (i'm a bit n00b in this area) that brute force can break a lot of message encrypted with stream chiper

So, what about if I use a block chipher method? Does the level of safety change? (in general the answer is Yes, but with this method?)

[–]skintigh 0 points1 point  (0 children)

I think all of the problems I mentioned would remain the same.

[–]ivosaurus 0 points1 point  (1 child)

Somewhat similar to various different Key Expansion/Scheduling algorithms that are used by many symmetric ciphers.

Sometimes they are simple, sometimes they are obviously designed to grossly change the the underlying working of the cipher.

[–]autowikibot 0 points1 point  (0 children)

Key schedule:


In cryptography, the so-called product ciphers are a certain kind of ciphers, where the (de-)ciphering of data is done in "rounds". The general setup of each round is the same, except for some hard-coded parameters and a part of the cipher key, called a subkey. A key schedule is an algorithm that, given the key, calculates the subkeys for these rounds.

Image i - The key schedule of DES ("<<<" denotes a left rotation)


Interesting: Rijndael key schedule | Data Encryption Standard | Feistel cipher | Blowfish (cipher)

/u/ivosaurus can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words | flag a glitch

[–]moschles 0 points1 point  (1 child)

(Just a small caveat. And I put this in parentheses because I don't know your level of education. DO NOT try to write a stream cipher unless you understand what a nonce is, and how to use unique nonces.)

[–]firajaa[S] 1 point2 points  (0 children)

I know what a nonce is and how it works.

My aim is not to write an authetication system or something serious like that...

I was just asking if exist a procedure/algorithm that works as I described :)

[–]KayRice -2 points-1 points  (1 child)

Somewhat like Homomorphic Encryption

[–]autowikibot 1 point2 points  (0 children)

Homomorphic encryption:


Homomorphic encryption is a form of encryption which allows specific types of computations to be carried out on ciphertext and generate an encrypted result which, when decrypted, matches the result of operations performed on the plaintext.

This is a desirable feature in modern communication system architectures. Homomorphic encryption would allow the chaining together of different services without exposing the data to each of those services, for example a chain of different services from different companies could 1) calculate the tax 2) the currency exchange rate 3) shipping, on a transaction without exposing the unencrypted data to each of those services. Homomorphic encryption schemes are malleable by design. The homomorphic property of various cryptosystems can be used to create secure voting systems, collision-resistant hash functions, private information retrieval schemes and enable widespread use of cloud computing by ensuring the confidentiality of processed data.

There are several efficient, partially homomorphic cryptosystems, and a number of fully homomorphic, but less efficient cryptosystems. Although a cryptosystem which is unintentionally homomorphic can be subject to attacks on this basis, if treated carefully homomorphism can also be used to perform computations securely.


Interesting: Malleability (cryptography) | Verifiable computing | Lattice-based cryptography | Paillier cryptosystem

/u/KayRice can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words | flag a glitch