instruction
stringlengths
32
27.2k
I was researching the Even-Mansour scheme and had a question that wasn't addressed in the paper that I saw, and google was minimally helpful. What if a permutation that uses secret data like the Fisher-Yates shuffle was used as the F permutation instead of a publicly known one? Would the scheme still be equivalently se...
Lets say I need to update a project and allow anyone to distribute the updates, however I need it to be secure, so I hash the data and sign the hash, this project uses MD5. How likely would it be that a person could obtain the signing key or falsely sign files that could be distributed using the following information? ...
I've got everything else (e, p, q, phi(n), n), but cannot see a way to figure out what d should be. P and q are both 300 digits, so phi(n) and n are about 600 digits, but e is only 5 digits. I do already understand that ed is congruent to 1 mod phi(n). Thanks for any suggestions.
Currently my padding is adding a string of random characters $ l(N)/3 - (l(M) + 1) $ Long and just adding it to the messages, is this sufficient? $l(x)$ = length of a variable
Why do we need a field for RSA and what are the two operations in this field? Why can't we have a ring or group for example? Because in a group you also have inverse elements.
Regular plain CTR mode, is it vulnerable to any attack? I plan to write a program to encrypt a drive with ctr mode. Would this be wise? Would AES be better? When I look at this diagram, it looks pretty solid to me. If the question is "too broad", allow me to rephrase: Which is better, AES 256 or CTR mode like the pict...
As far as I can tell (from reading the Wikipedia article about it) decrypting a message encrypted with the vigenère cipher is possible on paper. But what would happen if the message is encrypted multiple times with a set of different keywords? "Thwaites challenged Babbage to break his cipher encoded twice, with keys o...
I need to know what is exactly DHE_EXPORT cipher suite and why it is still supported by some servers. Is there any implementation or details about this weak crypto?
I was studying about 'Data Security' and I found out this one thing confusing. What is a message digest? I got it is the hash of the message. Is the message here referring to the plaintext or cipher text? I believe when using Digital Signatures, the message itself is also encrypted with a public key.
Suppose that the attacker knows the SHA256 values of integers $n, n+1, n+2 ... n+k$. $n$ is sufficiently big, so we do not expect to be able to brute force $n$ just by $\operatorname{SHA256}(n)$ itself. $k$ is very small compared to $n$. Is there risk that he can calculate $n$ in reasonable time?
I have deterministic random bit generator (DRBG) to generate a random numbers in which it is 10 byte value and I want to turn this algorithm twice, what is the probability to get the two random equal and what is the maximum time to try to get this result ?
Using the crypto_aead_aes256gcm functions from Sodium produces a ciphertext of "at most mlen (plaintext length) + crypto_aead_aes256gcm_ABYTES bytes (16 bytes) are put into c (ciphertext), and the actual number of bytes is stored into clen if clen is not a NULL pointer. The phrase "at most" is deceiving because, in tes...
Is there a way to recover the public exponent e (assume in this case it is in fact not public) used in an encryption if I know the following: Factorization of N : p and q one plaintext m and its encryption c = m^e mod N Obviously I can just bruteforce if e is small, but is there a more elegant way? (or just assume e ...
Brief rundown of how Apple Push Notifications (APN) work: Generate a keypair, generate a CSR for it Upload the latter to your Apple Developer account and associate it with your mobile app In the process, your CSR is signed and you get to download the certificate Connect to the APN server using the key + certificate, s...
Let's say we generate a sentence in a way like for example this: Fix an initial seed. Attach '1' at the end of the seed and compute sha256 of such a string. This hash is our first number. Now attach 2 at the end of the seed(instead of 1 like in the previous step) and compute sha256 to get our 2nd number. And so on. Wil...
For ECB, CBC, and CFB, padding is required when the plaintext does not fill out a complete multiple of the block size. However, I have heard that is good practice to pad all messages, even if the plaintext does fill out a complete multiple of the block size. What benefit does doing such a thing have? Does it increase s...
I know this applies to secure ciphers, but does this also apply to hashes?
For some $k$, let's say $p = 1+ \prod_{j=1}^k q( j)$, where $q(1)=2$, $q(2)=3$, if $p$ is prime, the diffie-hellman key exchange is not secure in cyclic group $Z^*_p$. Why?
Let's have $P$ some sensitive piece of data and $K_1$a secret value, both known to Alice, but not to Bob. $K_1(P)$ means $P$ encrypted using $K_1$. Alice sends $K_1(P)$ to Bob. Bob keeps the value of $K_1(P)$. Later Alice decides to change her keys. She needs to replace $K_1$ with $K_2$. The goal is to do some transfor...
NIST SP800-56B standard (addressing IFC-based Key Establishment schemes) defines some key establishment (KE) schemes using the RSASVE primitive in which the common secret $Z$ is encrypted with RSA-EP (basic RSA encryption without padding). I understood that RSA encryption should mandate one of the two padded schemes (...
Suppose I have a key that is at least 32 characters in length and provides at least 128-bits of entropy. If I picked from the character set of [a-hjkmnp-z2-9-], then I know that each unambiguous character provides exactly 5 bits of entropy if built from a CSPRNG, such as /dev/urandom. Thus, a 32-character string would ...
I'm working on my bachelor thesis and I have some questions. I want to combine a CPA-secure private key encryption scheme and some unforgeable public key signature scheme (in my case some sanitizable signature scheme but I think it doesn't matter). The resulting scheme should be CCA-secure. How can I do that? If I use...
How can I work out Hamming distance between two binary vectors securely? I would like to know how I can apply homomorphic techniques here.
OK, in school, some of the lecturers always say "if you compound the crypto, it may make the cipher weaker". So, which combinations of algorithms would do this? Why? Can anyone show the mathematical proof? For example, would RSAk1(AESk2[AESk3[x]]) make the encrypted x weaker? Assuming all keys used are different and ra...
I've given a CPA secure private key encryption scheme (wich gets to a CCA secure scheme or better to an authenticated encryption scheme, when i combine it with a given MAC) and a unforgeable public key signature scheme. I want to combine both to get an authenticated encryption scheme. My approach was to first sign the...
I'm currently looking at changing the padding type from one of the Oracle Padding attacks to a secure one. Would this break data already encrypted using the old method?
Suppose m = 5 and N = 64. How do I choose the coefficients such that the polynomial is a permutation of nos from 0 to 63.?
I'd like to transmit a small amount of data, typ. 4 - 16 Byte through a channel that can be eavesdropped at any time. The behaviour, the way the data changes, should be protected too. I could encrypt it using XOR with a 4 - 16 Bytes key like this: c = m x k This means c is the same for the same m. When observing the c...
I am sending a signed email using Python and smtplib. I have successfully signed the email using this example: http://proj.badc.rl.ac.uk/svn/ndg-security/branches/Dependencies/m2crypto/doc/howto.smime.html My question is how does the end user get the public key to check the signature? I have not seen any examples of at...
I need to construct an AES key from an array of bytes (in Java), but I first I have to check if the key created from these bytes would be weak. Java can check for weakness for DES, but not for AES. What are the criteria for an AES key to be considered weak?
I am sure this is a very easy thing to do but I am not sure how to go about solving a problem like this, So there is this hash function which operates on a message which is in the form of a byte array (each element is 8 bits long): digest [i] = ( (129 * message[i]) XOR message[i-1]) % 256 The value of message[-1] is 0...
I have a question regarding Reduction Functions in Rainbow Tables. If the hashing function is MD5 or SHA-1 etc then should the reduction functions also be MD5 or SHA-1? That is, should the Reduction Function be the same as the Hashing Function but of course with a different set of rules/constraints for input and outpu...
We all know we should NOT roll our self-designed encryption algorithm, how about block cipher mode with a certificated cipher method like AES? Will a self-designed block cipher mode cause any flaws or weakness to the cipher? I have search over the Internet but can't find a answer. Hope here is the right place to ask s...
I was wondering whether, theoretically, 2 files can have the same SHA-256 value. Since there are only $16^{256}$ or $2^{1024}$ SHA256 sums, all 1024-bit files (with $2^{1024}$ different combinations) will have to have different SHA256 sums (if I'm not mistaken). Additionally, for files with larger file sizes (such as, ...
I can't understand the ECIES algorithm. I saw two different ECIES algorithms: Using only Public key Key generation: $A_{pri} : n_A$ $A_{pub} : n_A G$ $B_{pri} : n_B$ $B_{pub} : n_B G$ Encryption: Select a random $k$. A -> B to Cipher C : $\{kG, \text{message} + k B_{pub}\}$ Decryption $\text{message} + k B_{pub} - n...
My question is about how the padding is formated in TLS1.0, 1.1, 1.2, 1.3 I came across the PKCS7 format for the padding: somedatawith3bytesleft 03 03 03 aaasomedatawith2bytesleft 02 02 aaaaaasomedatawith1bytesleft 01 But when you read explanation on TLS padding you will see this : somedatawith3bytesleft 02 02 02 a...
I am using AES-CBC, authenticating using HMAC-SHA512 and I was wondering whether my thought process and implementation are correct. The message send over the network is: HMAC(64Bytes),IV(16Bytes),Ciphertext The MAC is calculate as follows: HMAC(sha1(secretKey),Plaintext) Is there a significant reason to use SHA-512 ov...
From Should we MAC-then-encrypt or encrypt-then-MAC?, I understand I should do Encrypt-than-MAC, which the MAC included all the information such as IV and cipher text. After reading Why choose an authenticated encryption mode instead of a separate MAC?, I know reusing key in Encryption and MAC may trigger unwanted weak...
I am studying cryptography and various block cipher modes of operation. Suppose I changed one bit in the last block of the message. Wouldn't that imply no change in all encrypted blocks except for the last one? At least based on the description of how various modes work (CBC, OFB, etc), I don't see why that wouldn't be...
I am trying to figure out an encryption algorithm whose key schedule function seems to be similar to RC6. However, it seems to be creating S-Boxes using 16-bit integers instead of 32-bit ones. I have posted some pseudocode below which is filling the S-Box, S is an array of 16-bit values and so is S_, except S_ is 27 * ...
I am using Integer Vector Homomorphic Encryption for the encryption lib. I have to multiply a learning rate of 0.01 (i.e. between 0 and 1) by the encrypted data (vector) but it is not integer. I had wanted to multiply by 1/10 instead. Is it possible? because it is know that HE scheme doesn't support division. Is the a...
I'm not even sure of the appropriate terminology to use to describe my problem so bear with me if the explanation is not exactly formal. Imagine I have a simple digital calculator, with a screen and some buttons. I bring this calculator into a room full of people. I ask them each one by one to take the calculator and a...
Can one extend the ChaCha and Salsa20 nonces by XORing the extra nonce bits with the key? My reasoning is as follows: the Rumba compression function allows attackers to supply any 48-byte input to the core, and HS1-SIV (a CAESAR 2nd round candidate) explicitly assumes and requires that ChaCha20 be secure in the relate...
GPG signing of Git commit tags relies on the collision resistance of SHA-1, which is weak. However, the attacker does not get to choose the prefix. How much does this translate to an actual vulnerability?
Why we take (base $e$) and (base 2) in natural and discrete logarithm, respectively? I do not understand the difference between these two concepts.
OK, so I am a real noob at cryptography stuff and I have a set of files. One is a string that I am trying to decrypt, and the other has this SHA: 4534e95cb5f001719a6119a092459dc826965d60 Can I use this to decrypt the string I have? And if so, how? I probably sound really stupid but I need help.
Assume that there is a smartcard or other hardware token that exposes the raw RSA private key operation (modular exponentiation, with or without CRT parameters). Is there any possibility that raw RSA leaks information about the private key that would not otherwise become available? Please clearly distinguish between at...
Say party A wants to make sure they are communicating with party B, and not an eavesdropper E. Then they will use an authentication scheme to do this. But what if there is an eavesdropper on the line, who waits until the authentication is complete, and then steps in a poses as party B when it is finished? Then A will s...
The title pretty much sums it up :) I'm looking for a hashing algorithm that does not need to be cryptographically secure beyond reducing the number of accidental collisions. There is no need to protect against a determined attacker. Naively I thought I could take a file, cut it up into 1Gb chunks, hash each chunk indi...
I need 32 byte pseudorandom sequences that denote unique filenames and am currently using this Python code: import base64 import hashlib from django.utils import timezone from uuid import uuid4 def get_name(): data = str(uuid4()) + str(timezone.now()) hash = base64.b64encode(hashlib.sha256( d...
In the first block cipher I designed I used a CSPRNG to generate the round keys. The purpose was to at least have a chance of creating a (hopefully!) secure cipher on the first try (but please don't use it in production). One criticism I got was that the key schedule was too expensive. This made me wonder: what are t...
How polynomial based encryption schemes such as NTRU encode messages in to polynomials? Is there a generic conversion?
I know that the ChaCha20 core (without the initial constant) is not an ideal PRP and must not be used as such. I also know that $\text{ChaChaCore}(0) = 0$. Are there any other differences?
Alice and Bob are using DHKE in the group $\mathbb{Z}_p^ * $, where $p = 1031 = 2 \cdot 5 \cdot 103 + 1$. Their generator $g = 2$, which generates a multiplicative group of order $515$ in $\mathbb{Z}_{1031}^ * $. This group has a subgroup consisting of $5$ elements $\{ 1,518,264 = {518^2},660 = {518^3},619 = {518^4}\}...
Let's consider such process: Two emitents emit two (integer) secret numbers independently They encrypt (encode) these number in such a way that no-one (except emitent) can decode these numbers. Emitents also cannot decode/know numbers of each other. Now having two block of decoded numbers we need to find the sum of th...
I am working on a password manager application that saves the user's passwords in a remote server. I need to use AES in CTR mode to encrypt the passwords before sending them to the server. The client is supposed to login/identify himself with a master password (which is already set in the server). This is what I've tho...
I want to encrypt a message that contains a fixed length random number and a long mod. i.e. 1234564284 (created like this 123456 + (123456 mod 9931)) I assume that reusing the same key is not a problem if the message is purely random but is the fact that the message is always given with a mod is opening a hole to find...
If a stream cipher has an $n$-bit internal state, how many bits of known plaintext are required to confirm that particular key is the key? I believe that the answer is at least $n$-bit's of plaintext. My reasoning is that an $n$-bit state would allow it to generate at most $2^n$ different key-streams, assuming it was a...
An excerpt from the wikipedia article on slide attacks states: ...The only requirements for a slide attack to work on a cipher is that it can be broken down into multiple rounds of an identical F function. This probably means that it has a cyclic key schedule. The F function must be vulnerable to a known-plaintext at...
Let's say that you have a symmetric cipher which takes in an 8 bit plain text value and a key, and generates cipher text which can be decoded using the key to get the original plain text value. Since this is just an 8 bit plain text value, versus say some text document in english (or other source material where the for...
This is a bit of a cross-posted question which I first asked at StackOverflow, however I was not satisfied with stackoverflow, so I came here for an in depth answer. I, as they say, "rolled my own cryptosystem". It is a C# CTR encryption method, that is modified. Based off of this diagram: I hate the idea of padding, ...
In the book written by Ivan Damagard titled "Secure Multiparty Computation and Secret Sharing", at the end of the third chapter he provides a proof for why it is impossible to securely compute 2 party AND function under perfect and passive security with one corrupt party. Can someone help me provide an intuitive expla...
It is commonly understood that CRC satisfies the linear identity with respect to the $\oplus$ (XOR) operation: $\operatorname{CRC}(a) \oplus \operatorname{CRC}(b) = \operatorname{CRC}(a \oplus b)$ But after some experimentation and research it appears that this is not generally true. The particular algorithm in questio...
I want to create an app that encrypts a file and saves it to the Dropbox. Thus, I open and edit this file, I want the file is already decrypted, but the encrypted file that stored in Dropbox still in cipher text. Whenever I update/edit this file, encrypted file that stored in Dropbox also update. Is this possible?
Linux has the familiar problem that /dev/random blocks too much (insisting on being information-theoretically secure), while /dev/urandom doesn't block enough (it will return data before it's been adequately seeded). The new getrandom() system call does the Right Thing, but as of this writing it's not yet universally a...
If the 48-bit input to the S-box is 0xAAAAAAAAAAAA, what are the first four bits emitted by S-box 1? Answer: 0110 I know that an S-Box takes n inputs and give m outputs and that n != m, but I really don't see how they got that answer. Since a S-Box takes 3 bits and maps it to 2 bits how can you predict what AAA will be...
From Wikipedia's article on ECDH: The public keys are either static (and trusted, say via a certificate)… Also see this question on this very site. These indicate to me that a certificate (maybe an X.509 certificate) can have a(n) (elliptic curve) Diffie-Hellman public key as the data that is authenticated by it. Is ...
I am trying to compute the multiplicative inverse in galois field $2^8$.The question is to find the multiplicative inverse of the polynomial $x^5+x^4+x^3$ in galois field $2^8$ with the irreducible polynomial $x^8+x^4+x^3+x+1$. To get it I used the Extended Euclidean division but with operations used in galois field $2...
Consider a cyclic group $G$ of order $q$, and let $g$ be a generator for $G$. Assume $(G, q, g)$ is public. Consider the following 1-bit public-key encryption scheme. To $generate (pk,sk)$: $x \xleftarrow{\$} {1, , 2, . . . , q}$ $h ← g^x$ $pk ← h, sk ← x$ Return $(pk, sk)$ To encrypt the message $M = 0$, we define $...
Let $X,X',Y,Y'$ be some distribution ensembles such that $X\sim X'$ and $Y\sim Y'$, where $\sim$ means computational indistinguishable. Define $(X,Y)$ be the distribution ensemble over $\{0,1\}^{2n}$ for each $n$ such that $P[(X,Y)=(x,y)]=P[X=x]*P[Y=y]$ and $(X',Y')$ similarly. My question is: Does $(X,Y)\sim (X', Y')...
I am writing an application that uses Elliptic curve Diffie–Hellman for authentication. I found two formulas for point doubling in Jacobian coordinates. 1st) \begin{equation} X_1 = (3x^2 + aZ^4)^2 - 8xy^2 \end{equation} 2nd) \begin{equation} X_1 = (3 (x - z^2)(x + z^2))^2 - 8xy^2 \end{equation} The second formula is f...
I've given a CPA secure private key encryption scheme, an unforgeable private key MAC scheme and an unforgeable public key signature scheme. I want to combine them to protect confidentiality, integrity and authenticity. I have to use the signature scheme, such that some third party can prove authenticity and integrity ...
Why is the padded RSA construction given in the picture not CCA secure?
Within RFC 2104 section 3 there is discussion around keys (below). How are these keys agreed upon/distributed? Practically speaking is asymmetric crypto a requirement to "bootstrap" and distribute keys? "Keys need to be chosen at random (or using a cryptographically strong pseudo-random generator seeded with a rando...
It seems that RSA-KEM has a very troublesome method of generating the secret $r$. It seems that the random value needs to be in the range $0 \le r \le {n - 1}$. Now most cryptographic environments don't have a random number generator that generates those kind of numbers; usually they are just provided with a seeded DRB...
I want to create a system to host as securely as possible encrypted data in a way that not even the system can know the content of the data, but that it could be recovered. I would like to know how is it that other systems implement the use of a multiword recovery passphrase, like some bitcoin wallets for example, wher...
Is there anyway to detect encryption in real-time through a common signature or pattern recognition. Say, a file is being encrypted using an AES-256 cipher, if I have access to the file stream - can I reliably detect an encryption operation?
I've been looking into different ciphers that require very minimal computation power (calculator, deck of cards, index cards and a pencil), i.e. hand ciphers. For the most part all methods typically discussed are considered insecure with the advent of computers. Searching for patterns, testing against linguistic statis...
From the class: Shannon Theorem: For a perfect encryption scheme, the number of keys is at least the size of the message space (number of messages that have a non-zero probability). Proof: Consider ciphertext $c$. $c$ must be a possible encryption of any plaintext $m$. But, for this we need a different key per message...
If someone is signing a document using the ElGamal signature scheme, and if the random involved in the signature $k \mod (p-1)$ is equal to $a$ (the private key), can an attacker notice? If so can he then determine the value of $a$? Would it be because the $\beta = \alpha^a \mod p$ from the published key ($p$, $\alpha$...
This may be too broad question but it is not. I have been studying lattices for few months now, more specifically I studied: Lattice problems ($SVP$, $CVP$ and etc.) Lattice cryptography in post quantum computers Worst-case hardness in Lattice cryptography Public key encryption using Lattice Lattice reduction algorith...
I am currently working on a project, that requires using encryption libraries namely (LibScarab and FHEW). I want to know how can I compare the two schemes in terms of security (I already compared between them in terms of execution time). All I know that LibScarab uses SV scheme, while FHEW uses LWE scheme. Can I get h...
When $p$ and $q$ are distinct odd primes and $N = pq$, the points in $\mathbb Z_N^\ast$ have either zero or four square roots. A quarter of the points have four square roots; the rest have no square root. The four square roots of $x\in\mathbb Z_N^\ast$ will look like $\pm a$, $\pm b$. (Of course, $-a$ means $N-a$ ...
In formal proofs, you often need to use probabilities to show that the Advantage of an algorithm is negligible. In proofs by contradiction, these probabilities are often tied to probabilities of other, hypothetical algorithms. However, you may end up in situations where you need probabilities that you cannot simply inf...
So I'm trying to figure out the feasibility of using a Smart Card to decrypt files in an offline scenario. I wish to sync encrypted files to a mobile phone with a Smart Card reader case. The files should only be readable when the Smart Card is in the card slot. If the user looses the phone the files will be stored in a...
The authors of the book titled "Secure Multiparty Computation and Secret Sharing" claim that there exist functions which cannot be computed with passive perfect security for $t \geq n/2$ corrupt parties, where $n$ is the total number of parties. The authors prove this by showing that no protocol $\pi$ exists for secure...
I was taught that: although OTP is CPA secure, it is not the case with CCA. I'm trying to figure how to break OTP with CCA by showing how it fails the IND test. Note: Saw this answer, but didn't manage to extract a proper proof. So according to the test, the attacker chooses two messages m1, m2 of the same length, an...
Introduction I want securely communicate with a small 8-bit device which has a very limited program program memory (Arduino Uno - 32K). My goal is to minimize code size and RAM usage. There are multiple alternatives I could use, but I have reasons to believe that all of them would have larger code size and/or RAM usage...
I would like to implement an anti-counterfeiting scheme for tools my company manufactures. This would ideally be done via RFID/NFC tags. However, the environment in which these tags operate would either be behind a heavy firewall or not web-enabled at all. So a database of unique, valid numbers isn't feasible. I'd rath...
Pointcheval and Stern in their paper on "Security proofs for Signature Schemes" state the following "well-known" probabilistic lemma: Let $A \subset X \times Y$, such that $\mathrm{Pr}[A(x, y)] \geq \epsilon$, then there exists $\Omega \subset X$ such that $\mathrm{Pr}[x \in \Omega] \geq \epsilon/2$ whenever $a \in \...
My friend is trying to convince me that his linear hash function (with a few bit operations) is secure. Is there a way to disprove this? (Or prove this, but I've read from multiple sources that this kind of hash is very insecure). Sources would be greatly appreciated.
There are some PRNGs considered cryptographically secure. Which has the longest period among them?
I'm studying mechanisms of integrity and authentication in symmetric encryption scenarios. I want to propose some examples to see whether I got the point here: Let $m$ be the message, $c$ the ciphertext, $h$ the hashed message and $t$ the tag resulting of applying MAC. Example 1: Here Alice wants to send an enciphered ...
Blake2b has a lightning fast compression function with more-than-overkill security even against quantum attacks. It seems to be based on ChaCha, but with 64-bit words and different rotation constants. Is it possible to use this compression function with feed-forward as a stream cipher? If not, would a different varia...
I know it is used for digitally signing any data or message. It can be used for sending any message securely, but where is it applied in industries? Can anyone tell the practical applications of $\text{SHA-3}$ in brief?
Using Shamir secret sharing, one is starting with a secret and end up with a number of shares based on a polynomial. For example: INPUT: secret: 123456 Shares:4 Threshhold:2 OUTPUT (4 shares calculated): 8017f1267477aa02cf0e6c6b36c29 802fd24948eab5d04fd84912dd801 8038336c5c9e4fd1c0d5157acb419 804e4486f0114ba54e7403f0c...
I would like to use garbled circuits to provide a service that allows people to vote where they do not need to reveal their votes to my server or to anyone else. Let's assume that I have secure ways to generate garbled circuits, perform oblivious transfer for the inputs, and to evaluate the circuits. Let's also assume ...
Is there a recommended format or formal notation for documenting the combination of symmetric and asymmetric encryption, key derivation and other algorithms (and their inputs and outputs) that I think meet the needs of the software I'm contributing to the design of? At the moment we're blithely using statements like "E...
very new to crypto-stuff, i have to write a program in C that compute key(k) used in RC4 when I know open text(p) and ciphered(c) text so I have c_1=p_1 XOR k. How do I compute key from this? What is the "inverse" operation to XOR ?
Symmetric keys should be refreshed regularly. Is is terribly wrong to first agree on $N$ independent keys and then generate the key $k_j$ with $j>N$ by computing some form of hash on the keys $k_{j-100},k_{j-99},...,k_{j-2},k_{j-1}$? The idea being that an attacker would need to know the previous 100 keys to also be ab...