Hohha Dynamic XOR Algorithm Source Code

The source code is moved to GitHub in order to work collaboratively:



  1. Have you considered actually using version control? Maybe github or bitbucket or something? Posting code on a blog is just silly.

  2. OK Lucas, I am going to create a public repo on GITHUB

  3. Lucas:

  4. Keep up the work, hope the edge cases that were brought up in the mailing list can be worked on.

  5. Thank you My8th
    Every comment, every idea, every criticism does count.
    It is "our" work. You are all welcome to participate

  6. So how do you encrypt and decrypt data with it?

  7. I am going to write the README file on GitHUB tomorrow. OK?

  8. I hope it works. It's all about combinations and distractions from retracing path of sets.

  9. Operation

    M = (M ^ Body[M]) & BodyMask;

    will clear all bits save those present in Bodymask, whcih is length of plainetxt minus 1.

    In other words, you only use no more than 2**(bitnum) positions in Body array, where bitnum is a number of bits in binary representation of BodyMask.

    Imagine that BodMask is, say, 0x10000000. That means your algorithm only chooses one of two (!!!) positions on Body array. Is it what you really mean to do?

    Have you put your algorithm to real statistical tests, analyzing its real complexity and reliabilty?

  10. Thank you Konstantin, for your attention.
    I am going to fix it.
    That's why I put it into public domain. We see each other's mistakes.

  11. Thank you Konstantin. I've fixed it.
    But it was only affecting the key coverage.
    Clearing the key body bytes == BodyMask is a desirable situation, since, in the next round it will be updated again.
    The key is dynamically updated during the process. Clearing it is a very natural and desired situation.
    You can download the code, run the tests and see the randomness with trying different bmp.
    And no, I haven't applied any statistical tests or analysis.
    I opened it to public as a programmer toy to improve it together.
    Thank you again.

  12. Konstantin: I've fixed the code with + op instead of XOR but, I think it will be better to leave it as it is, I mean XOR and limit the max. key body size to 256 bytes.
    What do you think?

  13. Hello Ismail,

    On Github, I see the same code where BodyMask is ANDed (&), thus the same problem with reducing indices amount.

    Perhaps you means something like

    M = (M ^ LastCipherTextVal) % BodyMask;

    instead of

    M = (M ^ LastCipherTextVal) & BodyMask;

    but please reflect the change in all the functions on GitHub.

    I haven't run serious code investigation so far, but please take into account the following:

    1. The operation


    should perhaps be replaced with

    LastPlainTextVal % SALT_SIZE

    (see the problen with BodyMask for erason why

    2. Studies should be made, whether the algorithm can be attacekd with rainbox tables-like approach (percomputed tables), especially if part of plaintext is known.

    That is, thorough tests should be made before you offer your algorithm to the wide public. It could be sad if major vulnerability to simple attacks could be found.

    I also recommend communicating with me over email, since comments here are inconvenient means, to me.

    Good luck.

  14. Thank you Konstantin,
    I really appreciate your help.
    I haven't your e-mail address. So I am writing here. Send your e-mail address to ikizir@gmail.com. We may continue privately.

    First time you showed me that code part, I just changed the code to + instead of ^.
    But the overall speed has decreased.
    Then, I decided to leave it as it is and limit the max. keysize to 256 bytes(which is 2048 bits) and then leave the lines as they are.
    2048 bit key size is really huge for a symmetrical algorithm. If someone needs longer keys, I can show him/her how to modify the code in order to do that.

    I am using & instead of % because & is doing the same thing % does and much much much faster than % if:
    BodyMask is a Mersenne Number
    And the BodyMask is always guaranteed to be a Mersenne number. Because we force user to choose a key length which is a power of 2!
    Using & instead of % is one of key optimization techniques of the code.

  15. Bu yorum bir blog yöneticisi tarafından silindi.

  16. Bu yorum bir blog yöneticisi tarafından silindi.


Yorum Gönder

Bu blogdaki popüler yayınlar

Anayasa'da, "Hukukta toplu sorumluluk"

Visual proofs of Hohha Dynamic XOR Encryption Algorithm