• Breaking News

    Monday, December 17, 2018

    Cryptography From Keys to Databases—Real-World Applications of Secure Multi-Party Computation

    Cryptography From Keys to Databases—Real-World Applications of Secure Multi-Party Computation


    From Keys to Databases—Real-World Applications of Secure Multi-Party Computation

    Posted: 16 Dec 2018 03:17 PM PST

    An idea on XOR cipher.

    Posted: 16 Dec 2018 05:25 AM PST

    First of all, I don't know that much about cryptography, but I'm really interested in the subject. Probably this method already exists; if so, please, let me know in the comments so I can learn more about it. Also, if it doesn't exists and you know a way to break the cipher, let me know as well.

    The big issue with XOR is frequency analysis, so I came up with this idea that, as far as I'm concerned, should make frequency analysis useless, leaving only brute force attacks.

    Given a byte array: [65, 66, 67, 68, 69, 70] ("ABCDE")

    Starting at position 1, add the previous value and then mod 256, resulting in: [65, 131, 198, 10, 79, 149].

    Now, XORring with a repeating key (for instance, [104, 121, 117, 105] ("hyui")) should give a final ciphered array with no possibility of running frequency analysis on. In this case, [41, 250, 179, 99, 39, 236].

    The deciphering will be similar, XOR again, and perform a byte substraction backwards.

    Here's an implementation in Python:

    #!/usr/bin/env python2.7 def xor(msg, key): for i in range(len(msg)): msg[i] ^= key[i%len(key)] return msg if __name__ == '__main__': msg = 'ABCDEF' key = 'hyui' msg = [ord(i) for i in msg] key = [ord(i) for i in key] # Encrypting print msg for i in range(1, len(msg)): msg[i]+=msg[i-1] msg[i]%=256 print msg msg = xor(msg, key) print msg # Decrypting print '' msg = xor(msg, key) for i in range(len(msg)-1, 0, -1): msg[i]-=msg[i-1] msg[i]%=256 print msg 

    The execution is:

    [65, 66, 67, 68, 69, 70] [65, 131, 198, 10, 79, 149] [41, 250, 179, 99, 39, 236] [65, 66, 67, 68, 69, 70] 

    submitted by /u/jlxip
    [link] [comments]

    No comments:

    Post a Comment