What type of encryption is this homebrew “encyption algorithm”? $$Why is writing your own encryption discouraged?What are recommended, general strategies to start block-cipher design and/or analysis?Easy explanation of “IND-” security notions?tweakable block cipher and ideal block cipherTraditional DES scheme in Unix crypt functionWhat exactly does a key do?What characters are valid in PGP encrypted and signed messages?How to perform frequency analysis of a substitution cipher using a Base64 alphabetHow many characters per block in an El Gamal ECC cryptosystem?Deciphering “easy” ciphers without hintsReverse Encryption Algorithm from Decryption codeCan a Vigenère cipher be solved if the alphabet is modified (custom)?How to decrypt a substitution cipher using a Base64 alphabetHow to know the type of encryption method

Is it a Munchausen Number?

Is this state of Earth possible, after humans left for a million years?

How to get my matrix to fit on the page

Is it nonsense to say B -> [A -> B]?

Removing all characters except digits from clipboard

My perfect evil overlord plan... or is it?

Was Mohammed the most popular first name for boys born in Berlin in 2018?

Why can't I prove summation identities without guessing?

Is ‘despite that’ right?

Examples where existence is harder than evaluation

date to display the EDT time

Is there an application which does HTTP PUT?

Improving Sati-Sampajañña (situative wisdom)

How is CoreiX like Corei5, i7 is related to Haswell, Ivy Bridge?

Succinct and gender-neutral Russian word for "writer"

Should I pay on student loans in deferment or continue to snowball other debts?

Would encrypting a database protect against a compromised admin account?

How to evaluate sum with one million summands?

Is it bad writing or bad story telling if first person narrative contains more information than the narrator knows?

Renting a house to a graduate student in my department

Why does the Earth follow an elliptical trajectory rather than a parabolic one?

Is a vertical stabiliser needed for straight line flight in a glider?

Are there variations of the regular runtimes of the Big-O-Notation?

Windows OS quantum vs. SQL OS Quantum



What type of encryption is this homebrew “encyption algorithm”? $$


Why is writing your own encryption discouraged?What are recommended, general strategies to start block-cipher design and/or analysis?Easy explanation of “IND-” security notions?tweakable block cipher and ideal block cipherTraditional DES scheme in Unix crypt functionWhat exactly does a key do?What characters are valid in PGP encrypted and signed messages?How to perform frequency analysis of a substitution cipher using a Base64 alphabetHow many characters per block in an El Gamal ECC cryptosystem?Deciphering “easy” ciphers without hintsReverse Encryption Algorithm from Decryption codeCan a Vigenère cipher be solved if the alphabet is modified (custom)?How to decrypt a substitution cipher using a Base64 alphabetHow to know the type of encryption method













0












$begingroup$


Background:

Quite a long time ago (somewhere 1998) I thought I was really clever and invented my own encryption/decryption code. Looking through old code I rediscovered my old algorithm. (No, it was never used in any production environment.)



I'm wondering what type of encryption my naive self invented back then. I'm guessing it is a polyalphabetic substitution cipher, but I'm not really sure?




My Questions:



  • What type of algorithm is this?

  • How weak is it against modern day cryptanalysis and what methods would be used to break it?


What the code below does:

The algorithm encrypts and decrypts based on a set 64 alphabets. Each alphabet consists of the same 64 characters in random order; each character is included exactly once per alphabet. This set of alphabets is effectively the key for the algorithm.



To start, the plaintext is base64 encoded. Then each individual character, in the base64 encoded plaintext, is substituted by a character from one of the alphabets. The first characters is (always) picked form the first alphabet, for subsequent characters the alphabet is selected based on the index-number of the substituted value of the character preceding it. So, it 'encrypts' one character at the time and, if one character in the ciphertext changes, the decryption will (most likely) be garbled from that point on.



The code also adds base64 style padding to the ciphertext, in an attempt to be 'even more secure' by passing of the ciphertext like regular base64 encoded data.




The Algorithm:



Encryption is being carried out over letters from a 64-element alphabet in the following mode:



$$C_0=F_0(P_0)quad C_i=F_C_i-1(P_i)$$



Where $F:mathbb Z_64times mathbb Z_64tomathbb Z_64$ represents 64 different, random, fixed permutations forming the key.



Reference PHP-Code can be found in the revision history.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    See Do we accept questions asking for cryptanalysis of your cipher (hash function, ...) design?
    $endgroup$
    – kelalaka
    Apr 30 at 15:19










  • $begingroup$
    @kelalaka, Yes, I read that part. But I'm not asking for cryptanalysis, I'm interested in the type of algorithm and the methods of cryptanalysis typically employed to defeat the given type of algorithms. Peer review is not part of the question at all.
    $endgroup$
    – Jacco
    Apr 30 at 15:51







  • 1




    $begingroup$
    See What are recommended, general strategies to start block-cipher design and/or analysis? then and Why is writing your own encryption discouraged?
    $endgroup$
    – kelalaka
    Apr 30 at 15:55











  • $begingroup$
    I'm well aware that writing your own crypto is highly discouraged. I'm my question I mentioned that a) the algorithm was written somewhere around 1998 and b) that I did not use it in production even then. I'm certainly will not attempt writing my own cipher today. I'm just interested in what type of algorithm I created back in the days I was still naive. Also, maybe we should continue this discussion in chat instead of in the comments?
    $endgroup$
    – Jacco
    Apr 30 at 16:00
















0












$begingroup$


Background:

Quite a long time ago (somewhere 1998) I thought I was really clever and invented my own encryption/decryption code. Looking through old code I rediscovered my old algorithm. (No, it was never used in any production environment.)



I'm wondering what type of encryption my naive self invented back then. I'm guessing it is a polyalphabetic substitution cipher, but I'm not really sure?




My Questions:



  • What type of algorithm is this?

  • How weak is it against modern day cryptanalysis and what methods would be used to break it?


What the code below does:

The algorithm encrypts and decrypts based on a set 64 alphabets. Each alphabet consists of the same 64 characters in random order; each character is included exactly once per alphabet. This set of alphabets is effectively the key for the algorithm.



To start, the plaintext is base64 encoded. Then each individual character, in the base64 encoded plaintext, is substituted by a character from one of the alphabets. The first characters is (always) picked form the first alphabet, for subsequent characters the alphabet is selected based on the index-number of the substituted value of the character preceding it. So, it 'encrypts' one character at the time and, if one character in the ciphertext changes, the decryption will (most likely) be garbled from that point on.



The code also adds base64 style padding to the ciphertext, in an attempt to be 'even more secure' by passing of the ciphertext like regular base64 encoded data.




The Algorithm:



Encryption is being carried out over letters from a 64-element alphabet in the following mode:



$$C_0=F_0(P_0)quad C_i=F_C_i-1(P_i)$$



Where $F:mathbb Z_64times mathbb Z_64tomathbb Z_64$ represents 64 different, random, fixed permutations forming the key.



Reference PHP-Code can be found in the revision history.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    See Do we accept questions asking for cryptanalysis of your cipher (hash function, ...) design?
    $endgroup$
    – kelalaka
    Apr 30 at 15:19










  • $begingroup$
    @kelalaka, Yes, I read that part. But I'm not asking for cryptanalysis, I'm interested in the type of algorithm and the methods of cryptanalysis typically employed to defeat the given type of algorithms. Peer review is not part of the question at all.
    $endgroup$
    – Jacco
    Apr 30 at 15:51







  • 1




    $begingroup$
    See What are recommended, general strategies to start block-cipher design and/or analysis? then and Why is writing your own encryption discouraged?
    $endgroup$
    – kelalaka
    Apr 30 at 15:55











  • $begingroup$
    I'm well aware that writing your own crypto is highly discouraged. I'm my question I mentioned that a) the algorithm was written somewhere around 1998 and b) that I did not use it in production even then. I'm certainly will not attempt writing my own cipher today. I'm just interested in what type of algorithm I created back in the days I was still naive. Also, maybe we should continue this discussion in chat instead of in the comments?
    $endgroup$
    – Jacco
    Apr 30 at 16:00














0












0








0


1



$begingroup$


Background:

Quite a long time ago (somewhere 1998) I thought I was really clever and invented my own encryption/decryption code. Looking through old code I rediscovered my old algorithm. (No, it was never used in any production environment.)



I'm wondering what type of encryption my naive self invented back then. I'm guessing it is a polyalphabetic substitution cipher, but I'm not really sure?




My Questions:



  • What type of algorithm is this?

  • How weak is it against modern day cryptanalysis and what methods would be used to break it?


What the code below does:

The algorithm encrypts and decrypts based on a set 64 alphabets. Each alphabet consists of the same 64 characters in random order; each character is included exactly once per alphabet. This set of alphabets is effectively the key for the algorithm.



To start, the plaintext is base64 encoded. Then each individual character, in the base64 encoded plaintext, is substituted by a character from one of the alphabets. The first characters is (always) picked form the first alphabet, for subsequent characters the alphabet is selected based on the index-number of the substituted value of the character preceding it. So, it 'encrypts' one character at the time and, if one character in the ciphertext changes, the decryption will (most likely) be garbled from that point on.



The code also adds base64 style padding to the ciphertext, in an attempt to be 'even more secure' by passing of the ciphertext like regular base64 encoded data.




The Algorithm:



Encryption is being carried out over letters from a 64-element alphabet in the following mode:



$$C_0=F_0(P_0)quad C_i=F_C_i-1(P_i)$$



Where $F:mathbb Z_64times mathbb Z_64tomathbb Z_64$ represents 64 different, random, fixed permutations forming the key.



Reference PHP-Code can be found in the revision history.










share|improve this question











$endgroup$




Background:

Quite a long time ago (somewhere 1998) I thought I was really clever and invented my own encryption/decryption code. Looking through old code I rediscovered my old algorithm. (No, it was never used in any production environment.)



I'm wondering what type of encryption my naive self invented back then. I'm guessing it is a polyalphabetic substitution cipher, but I'm not really sure?




My Questions:



  • What type of algorithm is this?

  • How weak is it against modern day cryptanalysis and what methods would be used to break it?


What the code below does:

The algorithm encrypts and decrypts based on a set 64 alphabets. Each alphabet consists of the same 64 characters in random order; each character is included exactly once per alphabet. This set of alphabets is effectively the key for the algorithm.



To start, the plaintext is base64 encoded. Then each individual character, in the base64 encoded plaintext, is substituted by a character from one of the alphabets. The first characters is (always) picked form the first alphabet, for subsequent characters the alphabet is selected based on the index-number of the substituted value of the character preceding it. So, it 'encrypts' one character at the time and, if one character in the ciphertext changes, the decryption will (most likely) be garbled from that point on.



The code also adds base64 style padding to the ciphertext, in an attempt to be 'even more secure' by passing of the ciphertext like regular base64 encoded data.




The Algorithm:



Encryption is being carried out over letters from a 64-element alphabet in the following mode:



$$C_0=F_0(P_0)quad C_i=F_C_i-1(P_i)$$



Where $F:mathbb Z_64times mathbb Z_64tomathbb Z_64$ represents 64 different, random, fixed permutations forming the key.



Reference PHP-Code can be found in the revision history.







encryption






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 1 at 6:16







Jacco

















asked Apr 30 at 15:09









JaccoJacco

1116




1116







  • 1




    $begingroup$
    See Do we accept questions asking for cryptanalysis of your cipher (hash function, ...) design?
    $endgroup$
    – kelalaka
    Apr 30 at 15:19










  • $begingroup$
    @kelalaka, Yes, I read that part. But I'm not asking for cryptanalysis, I'm interested in the type of algorithm and the methods of cryptanalysis typically employed to defeat the given type of algorithms. Peer review is not part of the question at all.
    $endgroup$
    – Jacco
    Apr 30 at 15:51







  • 1




    $begingroup$
    See What are recommended, general strategies to start block-cipher design and/or analysis? then and Why is writing your own encryption discouraged?
    $endgroup$
    – kelalaka
    Apr 30 at 15:55











  • $begingroup$
    I'm well aware that writing your own crypto is highly discouraged. I'm my question I mentioned that a) the algorithm was written somewhere around 1998 and b) that I did not use it in production even then. I'm certainly will not attempt writing my own cipher today. I'm just interested in what type of algorithm I created back in the days I was still naive. Also, maybe we should continue this discussion in chat instead of in the comments?
    $endgroup$
    – Jacco
    Apr 30 at 16:00













  • 1




    $begingroup$
    See Do we accept questions asking for cryptanalysis of your cipher (hash function, ...) design?
    $endgroup$
    – kelalaka
    Apr 30 at 15:19










  • $begingroup$
    @kelalaka, Yes, I read that part. But I'm not asking for cryptanalysis, I'm interested in the type of algorithm and the methods of cryptanalysis typically employed to defeat the given type of algorithms. Peer review is not part of the question at all.
    $endgroup$
    – Jacco
    Apr 30 at 15:51







  • 1




    $begingroup$
    See What are recommended, general strategies to start block-cipher design and/or analysis? then and Why is writing your own encryption discouraged?
    $endgroup$
    – kelalaka
    Apr 30 at 15:55











  • $begingroup$
    I'm well aware that writing your own crypto is highly discouraged. I'm my question I mentioned that a) the algorithm was written somewhere around 1998 and b) that I did not use it in production even then. I'm certainly will not attempt writing my own cipher today. I'm just interested in what type of algorithm I created back in the days I was still naive. Also, maybe we should continue this discussion in chat instead of in the comments?
    $endgroup$
    – Jacco
    Apr 30 at 16:00








1




1




$begingroup$
See Do we accept questions asking for cryptanalysis of your cipher (hash function, ...) design?
$endgroup$
– kelalaka
Apr 30 at 15:19




$begingroup$
See Do we accept questions asking for cryptanalysis of your cipher (hash function, ...) design?
$endgroup$
– kelalaka
Apr 30 at 15:19












$begingroup$
@kelalaka, Yes, I read that part. But I'm not asking for cryptanalysis, I'm interested in the type of algorithm and the methods of cryptanalysis typically employed to defeat the given type of algorithms. Peer review is not part of the question at all.
$endgroup$
– Jacco
Apr 30 at 15:51





$begingroup$
@kelalaka, Yes, I read that part. But I'm not asking for cryptanalysis, I'm interested in the type of algorithm and the methods of cryptanalysis typically employed to defeat the given type of algorithms. Peer review is not part of the question at all.
$endgroup$
– Jacco
Apr 30 at 15:51





1




1




$begingroup$
See What are recommended, general strategies to start block-cipher design and/or analysis? then and Why is writing your own encryption discouraged?
$endgroup$
– kelalaka
Apr 30 at 15:55





$begingroup$
See What are recommended, general strategies to start block-cipher design and/or analysis? then and Why is writing your own encryption discouraged?
$endgroup$
– kelalaka
Apr 30 at 15:55













$begingroup$
I'm well aware that writing your own crypto is highly discouraged. I'm my question I mentioned that a) the algorithm was written somewhere around 1998 and b) that I did not use it in production even then. I'm certainly will not attempt writing my own cipher today. I'm just interested in what type of algorithm I created back in the days I was still naive. Also, maybe we should continue this discussion in chat instead of in the comments?
$endgroup$
– Jacco
Apr 30 at 16:00





$begingroup$
I'm well aware that writing your own crypto is highly discouraged. I'm my question I mentioned that a) the algorithm was written somewhere around 1998 and b) that I did not use it in production even then. I'm certainly will not attempt writing my own cipher today. I'm just interested in what type of algorithm I created back in the days I was still naive. Also, maybe we should continue this discussion in chat instead of in the comments?
$endgroup$
– Jacco
Apr 30 at 16:00











2 Answers
2






active

oldest

votes


















2












$begingroup$


What type of algorithm is this?




The best capturing for this algorithm that I can see would be as "mode of operation for a tweakable block cipher" with the tweakable block cipher being the one that has keyspace size $(64!)^64approx 2^18943$ and in its current representation uses (at least) $64^2cdot 6=24576$ bits for key representation. The tweak size is 64 as is the message and ciphertext space. Key decoding then works by partitioning the key into 64 equal-sized strings and then using each string to identify one permutation over 64 elements. Encryption works by selecting the permutation indicated in the tweak and applying it.



Using the notation $E^textTweak_textKey(textPlaintextLetter)$ the mode is then $$C_0=E_K^0(P_0)quad C_i=E^C_i-1_K(P_i)$$ for a given plaintext sequence $P_i$ and the corresponding ciphertext sequence $C_i$ and the key $K$.




How weak is it against modern day cryptanalysis and what methods would be used to break it?




This construction has four main problems for modern cryptography:



  1. Ridiculous keysize (for symmetric cryptography). It takes 2.3kB to represent the key, normally our keys use 32 bytes which is plenty (because you can't search $2^256$ fully).

  2. Small block size. This is a problem in and of itself as an attacker can just build a dictionary of the input-output pairs by making a sufficient number of block cipher queries (this is part of the reason why modern block ciphers use 128 instead of 6 bit blocks).

  3. Deterministic Encryption. The given encryption scheme cannot be CPA secure, because it is deterministic. That is an attacker can recognize whether two encryptions yield the same value. Even worse, this scheme has the same issue as CBC (the best one could hope for in online deterministic encryption), namely it leaks prefixes. If I encrypt abcde and then encrypt abcgh under the same key, the attacker can see that the messages were equal up to abc.

  4. Lack of authentication. In theory one could think about fixing the previous point by forcing $P_0$ to be a random value (that's what CBC does). In this case this construction might be secure against CPA attackers. But of course it still isn't secure against the most standard adversary model in modern cryptography: CCA secure, that is attackers who also get to ask for decryptions (with one exception input). To break CCA security when given a challenge ciphertext of one of two possible plaintexts an attacker would simply change the last ciphertext letter and ask for the decryption and use the first few letters to determine what plaintext was encrypted.

Also if you don't understand something in this answer, please just ask (in the comments) and don't be frightened if you think "it should be obvious" or something like that.






share|improve this answer









$endgroup$












  • $begingroup$
    Actually the question whether this mode would be secure (within bounds because of the small block size) assuming $P_0$ is random would be quite intriguing...
    $endgroup$
    – SEJPM
    Apr 30 at 18:48










  • $begingroup$
    Actually CBC would also be an instance of this mode with $E_K^T(P)=E'_K(Toplus P)$ with $E'$ being something like AES, so I suppose one could potentially adapt the CBC security proof if one wanted to...
    $endgroup$
    – SEJPM
    Apr 30 at 18:53











  • $begingroup$
    I'm going to read your answer with a search engine as my friend. So it may take me a while to fully understand it, up to the level of detail I'm looking for.
    $endgroup$
    – Jacco
    Apr 30 at 19:12


















2












$begingroup$

This scheme reminds be of the Jefferson Wheel Cipher. Variants were actually used in the military so at one point the general idea was 'secure'.



If I understand it right, the presented construct seems weaker however and suffers a Know Plaintext Attack.



If I know P0, C0 and the algorithm then I can deduce one entry of the F0 alphabet. With 64 or so messages, I can get the full first alphabet. Given sufficient text, I can use the same idea to deduce all of the scrambled alphabets.



With these old style ciphers, it is interesting to consider if a cipher text only attack is possible. If we know that the language is US English then we can do a frequency count on the first letter of the cipher text. Based on that we can deduce some of the entries in F0. With sufficient cipher text, all of the most common letters could be pinpointed in all of the alphabets. At that point, the full set of alphabets could be unraveled with further frequency analysis and human deduction.



Working through the weakness of an older cipher is a great way to learn about modern cryptography. While there have been some big jumps, ciphers have mostly evolved against new and stronger attacks.






share|improve this answer









$endgroup$













    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "281"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f70194%2fwhat-type-of-encryption-is-this-homebrew-encyption-algorithm%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2












    $begingroup$


    What type of algorithm is this?




    The best capturing for this algorithm that I can see would be as "mode of operation for a tweakable block cipher" with the tweakable block cipher being the one that has keyspace size $(64!)^64approx 2^18943$ and in its current representation uses (at least) $64^2cdot 6=24576$ bits for key representation. The tweak size is 64 as is the message and ciphertext space. Key decoding then works by partitioning the key into 64 equal-sized strings and then using each string to identify one permutation over 64 elements. Encryption works by selecting the permutation indicated in the tweak and applying it.



    Using the notation $E^textTweak_textKey(textPlaintextLetter)$ the mode is then $$C_0=E_K^0(P_0)quad C_i=E^C_i-1_K(P_i)$$ for a given plaintext sequence $P_i$ and the corresponding ciphertext sequence $C_i$ and the key $K$.




    How weak is it against modern day cryptanalysis and what methods would be used to break it?




    This construction has four main problems for modern cryptography:



    1. Ridiculous keysize (for symmetric cryptography). It takes 2.3kB to represent the key, normally our keys use 32 bytes which is plenty (because you can't search $2^256$ fully).

    2. Small block size. This is a problem in and of itself as an attacker can just build a dictionary of the input-output pairs by making a sufficient number of block cipher queries (this is part of the reason why modern block ciphers use 128 instead of 6 bit blocks).

    3. Deterministic Encryption. The given encryption scheme cannot be CPA secure, because it is deterministic. That is an attacker can recognize whether two encryptions yield the same value. Even worse, this scheme has the same issue as CBC (the best one could hope for in online deterministic encryption), namely it leaks prefixes. If I encrypt abcde and then encrypt abcgh under the same key, the attacker can see that the messages were equal up to abc.

    4. Lack of authentication. In theory one could think about fixing the previous point by forcing $P_0$ to be a random value (that's what CBC does). In this case this construction might be secure against CPA attackers. But of course it still isn't secure against the most standard adversary model in modern cryptography: CCA secure, that is attackers who also get to ask for decryptions (with one exception input). To break CCA security when given a challenge ciphertext of one of two possible plaintexts an attacker would simply change the last ciphertext letter and ask for the decryption and use the first few letters to determine what plaintext was encrypted.

    Also if you don't understand something in this answer, please just ask (in the comments) and don't be frightened if you think "it should be obvious" or something like that.






    share|improve this answer









    $endgroup$












    • $begingroup$
      Actually the question whether this mode would be secure (within bounds because of the small block size) assuming $P_0$ is random would be quite intriguing...
      $endgroup$
      – SEJPM
      Apr 30 at 18:48










    • $begingroup$
      Actually CBC would also be an instance of this mode with $E_K^T(P)=E'_K(Toplus P)$ with $E'$ being something like AES, so I suppose one could potentially adapt the CBC security proof if one wanted to...
      $endgroup$
      – SEJPM
      Apr 30 at 18:53











    • $begingroup$
      I'm going to read your answer with a search engine as my friend. So it may take me a while to fully understand it, up to the level of detail I'm looking for.
      $endgroup$
      – Jacco
      Apr 30 at 19:12















    2












    $begingroup$


    What type of algorithm is this?




    The best capturing for this algorithm that I can see would be as "mode of operation for a tweakable block cipher" with the tweakable block cipher being the one that has keyspace size $(64!)^64approx 2^18943$ and in its current representation uses (at least) $64^2cdot 6=24576$ bits for key representation. The tweak size is 64 as is the message and ciphertext space. Key decoding then works by partitioning the key into 64 equal-sized strings and then using each string to identify one permutation over 64 elements. Encryption works by selecting the permutation indicated in the tweak and applying it.



    Using the notation $E^textTweak_textKey(textPlaintextLetter)$ the mode is then $$C_0=E_K^0(P_0)quad C_i=E^C_i-1_K(P_i)$$ for a given plaintext sequence $P_i$ and the corresponding ciphertext sequence $C_i$ and the key $K$.




    How weak is it against modern day cryptanalysis and what methods would be used to break it?




    This construction has four main problems for modern cryptography:



    1. Ridiculous keysize (for symmetric cryptography). It takes 2.3kB to represent the key, normally our keys use 32 bytes which is plenty (because you can't search $2^256$ fully).

    2. Small block size. This is a problem in and of itself as an attacker can just build a dictionary of the input-output pairs by making a sufficient number of block cipher queries (this is part of the reason why modern block ciphers use 128 instead of 6 bit blocks).

    3. Deterministic Encryption. The given encryption scheme cannot be CPA secure, because it is deterministic. That is an attacker can recognize whether two encryptions yield the same value. Even worse, this scheme has the same issue as CBC (the best one could hope for in online deterministic encryption), namely it leaks prefixes. If I encrypt abcde and then encrypt abcgh under the same key, the attacker can see that the messages were equal up to abc.

    4. Lack of authentication. In theory one could think about fixing the previous point by forcing $P_0$ to be a random value (that's what CBC does). In this case this construction might be secure against CPA attackers. But of course it still isn't secure against the most standard adversary model in modern cryptography: CCA secure, that is attackers who also get to ask for decryptions (with one exception input). To break CCA security when given a challenge ciphertext of one of two possible plaintexts an attacker would simply change the last ciphertext letter and ask for the decryption and use the first few letters to determine what plaintext was encrypted.

    Also if you don't understand something in this answer, please just ask (in the comments) and don't be frightened if you think "it should be obvious" or something like that.






    share|improve this answer









    $endgroup$












    • $begingroup$
      Actually the question whether this mode would be secure (within bounds because of the small block size) assuming $P_0$ is random would be quite intriguing...
      $endgroup$
      – SEJPM
      Apr 30 at 18:48










    • $begingroup$
      Actually CBC would also be an instance of this mode with $E_K^T(P)=E'_K(Toplus P)$ with $E'$ being something like AES, so I suppose one could potentially adapt the CBC security proof if one wanted to...
      $endgroup$
      – SEJPM
      Apr 30 at 18:53











    • $begingroup$
      I'm going to read your answer with a search engine as my friend. So it may take me a while to fully understand it, up to the level of detail I'm looking for.
      $endgroup$
      – Jacco
      Apr 30 at 19:12













    2












    2








    2





    $begingroup$


    What type of algorithm is this?




    The best capturing for this algorithm that I can see would be as "mode of operation for a tweakable block cipher" with the tweakable block cipher being the one that has keyspace size $(64!)^64approx 2^18943$ and in its current representation uses (at least) $64^2cdot 6=24576$ bits for key representation. The tweak size is 64 as is the message and ciphertext space. Key decoding then works by partitioning the key into 64 equal-sized strings and then using each string to identify one permutation over 64 elements. Encryption works by selecting the permutation indicated in the tweak and applying it.



    Using the notation $E^textTweak_textKey(textPlaintextLetter)$ the mode is then $$C_0=E_K^0(P_0)quad C_i=E^C_i-1_K(P_i)$$ for a given plaintext sequence $P_i$ and the corresponding ciphertext sequence $C_i$ and the key $K$.




    How weak is it against modern day cryptanalysis and what methods would be used to break it?




    This construction has four main problems for modern cryptography:



    1. Ridiculous keysize (for symmetric cryptography). It takes 2.3kB to represent the key, normally our keys use 32 bytes which is plenty (because you can't search $2^256$ fully).

    2. Small block size. This is a problem in and of itself as an attacker can just build a dictionary of the input-output pairs by making a sufficient number of block cipher queries (this is part of the reason why modern block ciphers use 128 instead of 6 bit blocks).

    3. Deterministic Encryption. The given encryption scheme cannot be CPA secure, because it is deterministic. That is an attacker can recognize whether two encryptions yield the same value. Even worse, this scheme has the same issue as CBC (the best one could hope for in online deterministic encryption), namely it leaks prefixes. If I encrypt abcde and then encrypt abcgh under the same key, the attacker can see that the messages were equal up to abc.

    4. Lack of authentication. In theory one could think about fixing the previous point by forcing $P_0$ to be a random value (that's what CBC does). In this case this construction might be secure against CPA attackers. But of course it still isn't secure against the most standard adversary model in modern cryptography: CCA secure, that is attackers who also get to ask for decryptions (with one exception input). To break CCA security when given a challenge ciphertext of one of two possible plaintexts an attacker would simply change the last ciphertext letter and ask for the decryption and use the first few letters to determine what plaintext was encrypted.

    Also if you don't understand something in this answer, please just ask (in the comments) and don't be frightened if you think "it should be obvious" or something like that.






    share|improve this answer









    $endgroup$




    What type of algorithm is this?




    The best capturing for this algorithm that I can see would be as "mode of operation for a tweakable block cipher" with the tweakable block cipher being the one that has keyspace size $(64!)^64approx 2^18943$ and in its current representation uses (at least) $64^2cdot 6=24576$ bits for key representation. The tweak size is 64 as is the message and ciphertext space. Key decoding then works by partitioning the key into 64 equal-sized strings and then using each string to identify one permutation over 64 elements. Encryption works by selecting the permutation indicated in the tweak and applying it.



    Using the notation $E^textTweak_textKey(textPlaintextLetter)$ the mode is then $$C_0=E_K^0(P_0)quad C_i=E^C_i-1_K(P_i)$$ for a given plaintext sequence $P_i$ and the corresponding ciphertext sequence $C_i$ and the key $K$.




    How weak is it against modern day cryptanalysis and what methods would be used to break it?




    This construction has four main problems for modern cryptography:



    1. Ridiculous keysize (for symmetric cryptography). It takes 2.3kB to represent the key, normally our keys use 32 bytes which is plenty (because you can't search $2^256$ fully).

    2. Small block size. This is a problem in and of itself as an attacker can just build a dictionary of the input-output pairs by making a sufficient number of block cipher queries (this is part of the reason why modern block ciphers use 128 instead of 6 bit blocks).

    3. Deterministic Encryption. The given encryption scheme cannot be CPA secure, because it is deterministic. That is an attacker can recognize whether two encryptions yield the same value. Even worse, this scheme has the same issue as CBC (the best one could hope for in online deterministic encryption), namely it leaks prefixes. If I encrypt abcde and then encrypt abcgh under the same key, the attacker can see that the messages were equal up to abc.

    4. Lack of authentication. In theory one could think about fixing the previous point by forcing $P_0$ to be a random value (that's what CBC does). In this case this construction might be secure against CPA attackers. But of course it still isn't secure against the most standard adversary model in modern cryptography: CCA secure, that is attackers who also get to ask for decryptions (with one exception input). To break CCA security when given a challenge ciphertext of one of two possible plaintexts an attacker would simply change the last ciphertext letter and ask for the decryption and use the first few letters to determine what plaintext was encrypted.

    Also if you don't understand something in this answer, please just ask (in the comments) and don't be frightened if you think "it should be obvious" or something like that.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 30 at 18:47









    SEJPMSEJPM

    29.9k659142




    29.9k659142











    • $begingroup$
      Actually the question whether this mode would be secure (within bounds because of the small block size) assuming $P_0$ is random would be quite intriguing...
      $endgroup$
      – SEJPM
      Apr 30 at 18:48










    • $begingroup$
      Actually CBC would also be an instance of this mode with $E_K^T(P)=E'_K(Toplus P)$ with $E'$ being something like AES, so I suppose one could potentially adapt the CBC security proof if one wanted to...
      $endgroup$
      – SEJPM
      Apr 30 at 18:53











    • $begingroup$
      I'm going to read your answer with a search engine as my friend. So it may take me a while to fully understand it, up to the level of detail I'm looking for.
      $endgroup$
      – Jacco
      Apr 30 at 19:12
















    • $begingroup$
      Actually the question whether this mode would be secure (within bounds because of the small block size) assuming $P_0$ is random would be quite intriguing...
      $endgroup$
      – SEJPM
      Apr 30 at 18:48










    • $begingroup$
      Actually CBC would also be an instance of this mode with $E_K^T(P)=E'_K(Toplus P)$ with $E'$ being something like AES, so I suppose one could potentially adapt the CBC security proof if one wanted to...
      $endgroup$
      – SEJPM
      Apr 30 at 18:53











    • $begingroup$
      I'm going to read your answer with a search engine as my friend. So it may take me a while to fully understand it, up to the level of detail I'm looking for.
      $endgroup$
      – Jacco
      Apr 30 at 19:12















    $begingroup$
    Actually the question whether this mode would be secure (within bounds because of the small block size) assuming $P_0$ is random would be quite intriguing...
    $endgroup$
    – SEJPM
    Apr 30 at 18:48




    $begingroup$
    Actually the question whether this mode would be secure (within bounds because of the small block size) assuming $P_0$ is random would be quite intriguing...
    $endgroup$
    – SEJPM
    Apr 30 at 18:48












    $begingroup$
    Actually CBC would also be an instance of this mode with $E_K^T(P)=E'_K(Toplus P)$ with $E'$ being something like AES, so I suppose one could potentially adapt the CBC security proof if one wanted to...
    $endgroup$
    – SEJPM
    Apr 30 at 18:53





    $begingroup$
    Actually CBC would also be an instance of this mode with $E_K^T(P)=E'_K(Toplus P)$ with $E'$ being something like AES, so I suppose one could potentially adapt the CBC security proof if one wanted to...
    $endgroup$
    – SEJPM
    Apr 30 at 18:53













    $begingroup$
    I'm going to read your answer with a search engine as my friend. So it may take me a while to fully understand it, up to the level of detail I'm looking for.
    $endgroup$
    – Jacco
    Apr 30 at 19:12




    $begingroup$
    I'm going to read your answer with a search engine as my friend. So it may take me a while to fully understand it, up to the level of detail I'm looking for.
    $endgroup$
    – Jacco
    Apr 30 at 19:12











    2












    $begingroup$

    This scheme reminds be of the Jefferson Wheel Cipher. Variants were actually used in the military so at one point the general idea was 'secure'.



    If I understand it right, the presented construct seems weaker however and suffers a Know Plaintext Attack.



    If I know P0, C0 and the algorithm then I can deduce one entry of the F0 alphabet. With 64 or so messages, I can get the full first alphabet. Given sufficient text, I can use the same idea to deduce all of the scrambled alphabets.



    With these old style ciphers, it is interesting to consider if a cipher text only attack is possible. If we know that the language is US English then we can do a frequency count on the first letter of the cipher text. Based on that we can deduce some of the entries in F0. With sufficient cipher text, all of the most common letters could be pinpointed in all of the alphabets. At that point, the full set of alphabets could be unraveled with further frequency analysis and human deduction.



    Working through the weakness of an older cipher is a great way to learn about modern cryptography. While there have been some big jumps, ciphers have mostly evolved against new and stronger attacks.






    share|improve this answer









    $endgroup$

















      2












      $begingroup$

      This scheme reminds be of the Jefferson Wheel Cipher. Variants were actually used in the military so at one point the general idea was 'secure'.



      If I understand it right, the presented construct seems weaker however and suffers a Know Plaintext Attack.



      If I know P0, C0 and the algorithm then I can deduce one entry of the F0 alphabet. With 64 or so messages, I can get the full first alphabet. Given sufficient text, I can use the same idea to deduce all of the scrambled alphabets.



      With these old style ciphers, it is interesting to consider if a cipher text only attack is possible. If we know that the language is US English then we can do a frequency count on the first letter of the cipher text. Based on that we can deduce some of the entries in F0. With sufficient cipher text, all of the most common letters could be pinpointed in all of the alphabets. At that point, the full set of alphabets could be unraveled with further frequency analysis and human deduction.



      Working through the weakness of an older cipher is a great way to learn about modern cryptography. While there have been some big jumps, ciphers have mostly evolved against new and stronger attacks.






      share|improve this answer









      $endgroup$















        2












        2








        2





        $begingroup$

        This scheme reminds be of the Jefferson Wheel Cipher. Variants were actually used in the military so at one point the general idea was 'secure'.



        If I understand it right, the presented construct seems weaker however and suffers a Know Plaintext Attack.



        If I know P0, C0 and the algorithm then I can deduce one entry of the F0 alphabet. With 64 or so messages, I can get the full first alphabet. Given sufficient text, I can use the same idea to deduce all of the scrambled alphabets.



        With these old style ciphers, it is interesting to consider if a cipher text only attack is possible. If we know that the language is US English then we can do a frequency count on the first letter of the cipher text. Based on that we can deduce some of the entries in F0. With sufficient cipher text, all of the most common letters could be pinpointed in all of the alphabets. At that point, the full set of alphabets could be unraveled with further frequency analysis and human deduction.



        Working through the weakness of an older cipher is a great way to learn about modern cryptography. While there have been some big jumps, ciphers have mostly evolved against new and stronger attacks.






        share|improve this answer









        $endgroup$



        This scheme reminds be of the Jefferson Wheel Cipher. Variants were actually used in the military so at one point the general idea was 'secure'.



        If I understand it right, the presented construct seems weaker however and suffers a Know Plaintext Attack.



        If I know P0, C0 and the algorithm then I can deduce one entry of the F0 alphabet. With 64 or so messages, I can get the full first alphabet. Given sufficient text, I can use the same idea to deduce all of the scrambled alphabets.



        With these old style ciphers, it is interesting to consider if a cipher text only attack is possible. If we know that the language is US English then we can do a frequency count on the first letter of the cipher text. Based on that we can deduce some of the entries in F0. With sufficient cipher text, all of the most common letters could be pinpointed in all of the alphabets. At that point, the full set of alphabets could be unraveled with further frequency analysis and human deduction.



        Working through the weakness of an older cipher is a great way to learn about modern cryptography. While there have been some big jumps, ciphers have mostly evolved against new and stronger attacks.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 30 at 20:29









        Matthew FisherMatthew Fisher

        275147




        275147



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Cryptography Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f70194%2fwhat-type-of-encryption-is-this-homebrew-encyption-algorithm%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

            Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

            Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020