instruction
stringlengths
32
27.2k
I want to calculate the hamming weight of a S-Box using this formula: $\text{hw}(f) = \sum_{x=0}^{2^n-1} f(x)$. Where $f: \{0, 1\}^n \rightarrow \{0, 1\}$ My problem is that I don't know how to get the $f$-function. I found that helpful paper: THE DESIGN OF S-BOXES. At Page 9 (18) boolean functions are described. But s...
I would like to learn more about a specific set of non invertible functions: The function should accept 2 inputs: one hidden and the other visible. The output and the function should also be visible. The hidden input will not change, the visible will. The function should be deterministic. Collisions are acceptable giv...
I have some hash function representations, which I find it hard to understand. I have searched a lot but didn't found anything helpful. Please help me understand the hash function representations given below: Choose cryptographic hash functions $H_1:\{0, 1\}^*\times\mathbb Z^∗_p\to\mathbb Z^∗_q$ $H_2:\{0, 1\}^*\ti...
In the context of SSL/TLS protocol and SLOTH vulnerability. I want to find out if certain websites(webservers) or applications that use TLS are vulnerable. I need some guidance for this. My idea is to develop/find a tool(maybe openssl) that connects to the servers and in the client hello asks for RSA-MD5 SignatureAndH...
While looking at the different versions of OTR protocol I discovered a strange thing: there is no trace of the patch for the weaknesses that were noted in “Finite-State Security Analysis of OTR Version 2”. It sounds very strange to me that authors of OTRv2 and OTRv3 did not manage to patch up the weaknesses and did not...
Can anyone explain how it's possible through hexadecimal or Binary 4 x E= D
Are these schemes fundamentally different? Are other schemes fundamentally different in the sense that you can do different operations with them (or the same operations, but needing different primitives)? For instance, Whit Diffie is on record as saying that he originally much preferred RSA because it provided signatur...
I have a hardware engine for SHA256 which can process 64K of data, but the input data size I am getting is around 1MB. What should I do to process 1MB size. What should be my input after 1st 64KB and what will be my IV (initial vector)? Can anyone provide any idea?
In RSA, it is basically equivalent to use the private key $d$ to encrypt as it is to use the public key $e$ to encrypt. They are exactly inverses: $e=d^{-1}$. I need to know, are there other public key schemes like this? E.g., I do not think Diffie-Hellman is like this.
I am trying to use AES as cipher for an application I am building. I am using a JavaScript library (https://code.google.com/p/crypto-js/) to perform encryption and decryption with AES. When I perform decryption, this happens: AES.decrypt(ct, right_key) == 'message decrypted !' //true AES.decrypt(ct, wrong_key) == '...
I understand that in Diffie-Hellman it should be hard to compute $a$ given $g$ and $g^a$. In computational Diffie-Hellman, it appears to be hard to compute $(g^{ab})$ from $g^a$ and $g^b$. As for the field, please consider $\mathbb F_p^*$ for this question. Is it also difficult to compute the discrete log $w$ of more ...
I stumbled upon this code on-line, it seems obvious to me that generating all 2^40 keys in trivial time can always be achieved as can hashing each and everyone of them, using the SHARED Salt that "Eve" could easily see: ### Here we outline: ### Sharing a SINGLE FOURTY BIT secret block, using the birthday problem (Proof...
I have come across this paper On-the-fly multiparty computation via on-the-cloud Multikey from Fully Homomorphic Encryption by Lopez-Alt et al., where authors describe a NTRU-based homomorphic encryption scheme suitable for a multikey context. Multikey means each party encrypts its input with its unique key, the serve...
I have designed a specific client and server program, which sends a file from client to server in 32k chunks. I want to encrypt only part of the data. More specifically: in each 32k chunk passing from client to server I want to encrypt only 500 bytes. This, in a non-continuous way (meaning: partial encryptionhere and ...
Is there any difference in adding the plain text and key vs using xor instead(apart from the performance improvements)?
It may seem that this is a programming question, but I just need advice on the cryptography side of the question. I want to implement the Diffie-Hellman key exchange algorithm on iOS (since no free library with easy integration exists). I'm wondering how the implementation would be if the parameters would be – for exam...
I am working with my project. I use projective coordinates but when I convert to affine coordinates, I can't get it. Can anyone help me? Projective Coordinates $(X,Y,Z)$ to Affine Coordinates $(X,Y)$: When $Z$ is not $0$ the point represented is the point (X/Z, Y/Z) in the Euclidean plane (Affine Coordinates) When $Z$...
I hope this question isn't too similar to one that's already been asked. I also want to point out I know part the answer already, AFAIK: I just want some expert input on this. Let's model a hash that more strictly is a possibly weak PBKDF. It would exist – if it worked – to slow down the cracking of passphrases (relati...
Given the affine form of coordinates $(x,y)$ such as $(5,3)$, if I want to convert $(5,3)$ to projective coordinates $(x,y,z)$, should the form of point be $(5,3,1)$? It is triplet not a point, right? So, is the true form from affine to projective $(x,y) \rightarrow (x/z),(y/z) \in Z_p$. For example: $(5,3) \rightarro...
To my understanding, symmetric encryption is where encrypting and decrypting data can occur with the same key. It's possible for symmetric encryption that the encrypting and decrypting algorithms are the same, but this is not always the case. If I'm not mistaken, with AES this could be the case for some block modes, no...
On forums I read DES has $2^{56}$ possible keys so it takes x times to brute force it with hardware x. But there are 64 total bits of which are 8 parity bits. But those parity bits are a 1 or 0, right? So since you still have to calculate the parity bits and since they aren't always the same bit, doesn't this mean that...
I am developing an application that is going to use AES encryption. Since it is going to use a different key for every message encrypted... Would it be secure to use a constant IV? (i.e null bytes) Would it be secure to not pad the encrypted message?
I want to use e-ID number for performing Encryption/Decryption and Digital Signing - and in order to do so, I've opted a PGP-oriented approach which goes a bit like this. Generating PGP key-pair using e-ID Number (pass-phrase protected) Digital Signing using e-ID Number (private-key) - and verifying the signature legi...
For symmetric key systems does perfect secrecy imply that all ciphers in the cipher space are equiprobable? I would think not, but I am finding it hard to come up with a counter example.
Say I have four files. Two are completely unencrypted, while the other two are the exact same files other than that they have been encrypted with (apparently) the same public key (via a ransomware virus). Is it possible to deduce the key from these files, so I can apply it to other files also encrypted with the same ke...
Suppose that Alice received the cipher values: $E(x_1), E(x_2), ..., E(x_n)$ that are encrypted using Paillier cryptosystem by $n$ entities with Bob's public key. Alice computes $E(\sum x_i)$ from the product of the cipher values she received. Alice sends $E(\sum x_i)$ to Bob for decryption, but she needs to prove tha...
In many Attribute Based Encryption papers I see this line... The advantage of an adversary A in this game is defined as Pr[b' = b] − 1/2. Can someone explain what it means to me? I assume it means that the chances of the guess being correct is equal to 1/2. Is this assumption accurate?
My question is how these concepts relate in ABE. I am assuming that the attributes are used to share the master secret key and only a user with the right attributes for a particular access tree is able to reconstruct the master secret key. Could someone help with some details on how this work.
I want to compute a multiplication between many secret values and then distribute the result to everyone involved. For this, I thought about an MPC protocol built from Threshold Homomorphic Elgamal. All I need is : to protect parties secret values to compute the product homomorphically and obtain the result encrypted ...
Are there any successful preimage attacks on any serious cryptographic hash algorithm or at least on serious-looking non-cryptographic hashes (like MurmurHash)?
I am looking for a "partial" encryption/decryption algorithm. Let's say I am encrypting the following List of IDs (long values) $[1,2,3,4]$ (with a secret key) to an encrypted string $e$, I would like to produce several keys $k_1,k_2,...,k_n$, which can decrypt just a subset (some IDs). For example: val rawIds = [1,2,3...
My question I guess is how the selection is done. A brief explanation with a simple access tree will be very helpful.
One possible explanation is, randomness is not going to hurt you, so might as well use it. Also, if we are hoping to prove impossibility, it only makes the result stronger. One other explanation is if the obfuscators are defined to be deterministic, then to satisfy the strong virtual black-box definition (and the weak...
In ChaCha20-Poly1305, I know that reusing a nonce loses confidentiality and integrity for all messages encrypted with the (key, nonce) pair. However, is security affected for those messages encrypted with the same key but different nonces?
Let's say I've got two people that are trying to talk in a public channel $A$ and $B$ and they want to preserve their confidentiality and integrity. Which cryptographic algorithm would they want to use? Symmetric, or public key based? Also, what type of algorithm suites best and in what key size? In my understanding,...
I am currently reading about the length extension attack on Flickr (pdf) but not understanding what's going on there. m = SECRET || data || padding` and `api_signature = md5(m) The server sends data and api_signature to the attacker. The attacker now knows: h = md5(m) = api_signature data length of data (Why does he ...
I would like to know how to generate a fingerprint for an openPGP public key. To be clear, I'm interested in how the fingerprint is generated. I'm aware that I can get the fingerprint with a commandline tool. I've consulted the PGP docs here, but haven't been able to reproduce the known fingerprint of the key I'm inte...
I've heard that it's possible to split up $GF(2^{128})$ into copies of several smaller fields like $GF(4)$ so as to make the math easier in some cases. How do you do that? I know how it works for groups modulo a composite number using regular arithmetic instead of carryless, such as when using the Chinese Remainder Th...
I want to encrypt some data(text/voice/video) but it is essential that the size of the cipher data remains the same as the plain data. Which techniques can I use, and how secure are these techniques as compared to the ones which increase the size of the data?
Isogeny-based cryptography is one of the newest post-quantum cryptography. Hardness of this system is based on finding isogeny between two elliptic curves. Also this is theorem: Elliptic curves are isogenous over $F_p$ if and only if they have equal number of points. Recently, isogeny based public key methods are w...
As per specifications document, "We have the natural restriction that at least two characters must be ciphered, i.e. $b \geq 2$" where each character is represented by an integer of certain cardinality. So basically a $2$ integer array is the minimum. However say I want to encrypt a single input integer but restrict ...
How can you determine the largest plaintext block size and smallest ciphertext size if you used RSA with $n=59768553302699443$ using an alphabet with $27$ characters?
We intend to encrypt certain values in a database which holds personal information such as addresses so as to prevent data leakage should the database be compromised. The intention is that each field is individually encrypted with AES GCM with a 128-bit key and 128-bit randomly generated nonce. Fields will generally be...
How to do padding to input giving to encrypt using AES algorithm if the input is less than 128 bits? I need to encrypt a decimal number such as 10.
I have been using the openssl function for encrypting data with AES-256-CBC in php. I have been able to encrypt it using an unique IV (by generating with openssl_random_pseudo_bytes)for each new encryption. But I am struggling with the idea of authenticated encryption with aes cbc. How do I basically authenticate when...
What is the best attack here? $E_k(m)=DES_{k1}(DES_{k2}(m)) \oplus k3$
In IBE schemes, the system parameters are $(q, \mathbb{G}, F, \hat{e}, P, Q, T, H_1)$. I don't know $\hat{e}$. For example, in type A pairing… type = a q = 9882642904117175329151553553252351229902817053795415486971970726488727491655222880560758411649004628450988330900153245798687927788524187202190684093251324134699938...
In general, after we design a secure cryptographic protocol and make sure that it is efficient (e.g., through complexity analysis), we implement it. Questions: Do we implement it for proof of concept? Do we implement it to support our claim that the protocol is efficient?
The title looks strange but it is to deal with this situation. The data we have should only be accessible by our end user and data administrators, not anyone else. Ideally, each user should have different encryption key. Even with administrators, I wish only when two of them agrees, then they could access the data by ...
I have a problem with this exercise: Let $G$ be a group of order a prime $q$ and let $g, h$, be two randomly selected elements of $G$, with $g,h\ne 1$. Consider the following hash function on integers $x_1$ and $x_2$: $H(x_1,x_2)=g^{x_1}h^{x_2} $ Show that the problem of finding a collision pair $(x_1',x_2')$ such tha...
Suppose i have a crypto provider, i.e: i give that provider some plaintext bytes and get the encrypted result. I don't know the used encryption method, but i know it is using a block cipher and the Block cipher mode of operation is something behaving like ECB (every block is encrypted individually => 2 identical blocks...
For a personal project, I'm building a password manager, based off the project in this syllabus from Stanford http://crypto.stanford.edu/~dabo/cs255/hw_and_proj/proj1.pdf Since I don't exactly have to take the class for the credit and strictly follow the instructions, I've gone ahead and changed some things (like I add...
I don't actually know what I'm talking about, so apologies if I get anything wrong. At the moment I have a password naming system for most of my online accounts that looks something like this: masterpassword + appname, where appname is the name of whatever service the password is for. ex. $sickpass123$_SoundCloud and $...
In the Wikipedia article about the ElGamal signature scheme it is written, that Fermat's little theorem is used in the following proof of correctness: From the signature generation in ElGamal we can derive, that: $$H(m) \equiv xr + sk \pmod {p-1}$$ Then - the article states - Fermat's little theorem implies the followi...
Someone posted an article on Reddit a few days ago, and I haven't found much about it except for links back to the same page. And for a brief summary, essentially, it's possible to introduce a backdoor during RSA key generation. For example, to generate a backdoored RSA-1024 key. (Assuming $\text{getPrime}(x)$ will ret...
I have been studying and researching hash functions. So far my research has led me to the sponge construction. It appears that the permutation used in the sponge to stir the state is more or less central to the security, along with the capacity/rate. Consequently, I have been making and breaking toy permutations to bet...
Commonly, Zero Knowledge Proofs based on the Hamiltonian Path or Cycle problems are given as follows: The Prover has a graph $G$, for which he knows a Hamiltonian Path (or Cycle). $G$ is also known to the Verifier and constitutes the public key. The Prover generates $G'$ which is isomorphic to $G$ via a permutation $\...
I found that there are quite some active research activities in a field named "physical layer security", with in particular some types of codes that apparently are different from those commonly treated in the conventional textbooks on coding theory. Could someone kindly explain the relevance, if any, of that field to ...
K is the shared key for encryption known by _Alice and _Bob. $N_A$ is a nonce created by Alice. The function f is the increment by 1 function. (1) Alice -> Bob: $E_K(N_A)$ So Alice encrypts a nonce with the shared key and sends it to Bob. (2) Bob -> Alice: $E_K(f(N_A))$ Bob receives it, I think first he needs to decryp...
I'm studying for a cryto exam and have run across this question which has stumped me. What is wrong in the following algorithm for computing a hash function? Take a message $M$, generate a random private RSA key $K$. Encrypt $M$ with $K$ and take the first 240 bits of the result as a hash of $M$
I have been considering this question now for a week and I just cannot find an answer. I understand that non-repudiation cannot be provided without data origin authentication but I cannot think of an application which satisfies that non repudiation is not necessary. Can anyone suggest an example of an application where...
if the client and the server need to exchange keys and I can sniff it, wouldn't I be able to decrypt the data transported?
Identity Based Encryption is covered under RFC 5091 (specifying the algorithm), 5408 (specifying data structures), and 5409 (using IBE with Cryptographic Message Syntax). However, every IBE implementation that I've seen and used are nothing more than glorified web-mail systems. Do any existing IBE systems allow secure ...
I have a case where it may be possible for an adversary to deduce the plaintext inputs that went into creating a AES-128-GCM encrypted message (there is good IV diversity across the encrypted messages, however) This opens up the potential to expose a GCM "oracle" to the adversary who may additionally be able to adaptiv...
In context SSL/TLS, reading up on various sites, I find forward secrecy in DH key exchange being linked to its ephemeral use i.e. DHE. I don't fully understand this link, where does following reasoning break? If non-ephemeral use (plain DH) would not provide forward secrecy, and ephemerality refers to a new session key...
Since we know that Homomorphic encryption allow computation on encrypted data. Let two n-bit integers $(x,y)$ are encrypted using some LWE public key cryptography. For example - if $x'= HEnc(x,pk)$ and $y'= HEnc(y,pk)$, Finding $Max(x',y')$ or $Min(x',y')$ or $Equal(x',y')$ the above comparison is necessary. Now, we n...
I am trying to devise an encryption scheme such that an adversary can win the following game with probability at most $1/2 + \epsilon$. Adversary gives challenger two plaintext messages $m_1$ and $m_0$ Challenger chooses one the two at random and encrypts it and gives adversary the cipher Adversary determines which of...
Let $x,y,k$ be plain text, cipher text and key respectively. Also suppose $\operatorname{Enc}$ is the algorithm of encryption for block cipher with size $n$. So we have $$\operatorname{Enc}_k(x)=y$$ We know that if $x,y$ are given finding $k$ for big $n$ is so hard. Now we change the problem: Let $k$(with size $l$) be ...
Last year, a question concerning plaintext attacks was posted at Mathematics.SE: “Plaintext attacks: affine cipher”. I have no problem to see how to solve it when we are given two ciphertexts and $(c_1,c_2)$ and their corresponding plaintexts $(m_1,m_2)$. But, when I am to deal with the situation where $p$ is unknown i...
In reference to the LR-Oracle experiment in “Introduction to Modern Cryptography” (2nd edition) by Lindell & Katz, Definition 3.23 states a scheme $\pi = (Gen,Enc_K,Dec_K)$ is CPA secure for multiple encryptions if (to use the notation of Lindell and Katz) $$\begin{equation} \textbf{Pr}[\textbf{PrivK}_{\mathcal{A},\pi}...
Assume a university want to elect the student council. This was done via paper ballot and there is a need to reach more students for voting, so electronic voting is on the table. While researching existing solutions I came across Helios: helios voting and agora voting Both seem to implement somewhat peer-reviewed schem...
Is the TLS protocol secure against VM reset attacks? Background: Imagine running cryptographic software inside a virtual machine (VM). A VM reset attack is one where the the state of the software is checkpointed (snapshot) at one point in time, allowed to run forward, and then reset (rolled back) to the previous snaps...
RC4 is known to leak information about the first few bytes of the ciphertext due to keystream biases. However, are there known attacks on RC4-drop[N] where N is large enough, that leak information about the plaintext? Edit: I am NOT planning on using this in actual software (I would use ChaCha20, Salsa20, or XSalsa20 i...
Poly1305 (and GHASH) are secure authenticators, but only for one use. Thus, nonce reuse in Poly1305-AES, ChaCha20-Poly1305, and AES-GCM all reveal the authentication key. However, my understanding is that this is because (in Poly1305-AES, ChaCha20-Poly1305, and AES-GCM) the output of the hash function is encrypted us...
I am looking at a cryptographic protocol in a somewhat unusual environment: the communicating parties can share arbitrarily long secret keys over a secure channel. If forward secrecy is not required, it seems that one can simply encrypt/authenticate a (random) 256-bit key using the 256-bit shared secret, and then start...
I don't know why BasicIdent is not chosen-ciphertext secure. If there are anybody who knows well, please explain it to me with example. Moreover, I don't know random oracle and its usage for security analysis.
The field prime numbers $p$ proposed by the NIST standards are referred to as Generalized Mersenne prime numbers [1] and as Pseudo Mersenne prime numbers [2]. Is there a difference between Pseudo Mersenne and Generalized Mersenne prime numbers? A lot of papers I recently read do claim that the primes proposed by the N...
It is well-known that the two-time pad is very insecure. However, it seems unexploitable in the case where the plaintext is indistinguishable from random (ex. symmetric keys). Is this property useful? Note: I don't plan on using this in production.
I am trying to understand $AES$ and I wondered what happens in the case of a $128$ bit block size and a $256$ bit key. All documents I read about $AES$ told me the key expansions algorithm for $128$ bit keys and $128$ bit blocks. But I have a $256$ bit key ($8$ words) and $128$ bit block ($4$ words) and I am not sure h...
I am implementing some pairing-based cryptography protocol using blynn's PBC library. I am only at the beginning and I wanted to confirm that preprocessing does increase the speed. However I seem to measure only a very tiny speed up. Question: Could someone tell me if this is normal and if not if there is a problem wit...
Suppose we have $(n,e)$ and the ciphertext $c$ where the public exponent $e$ is of the same length, 1023-bit, as the modulus $n$. It is also assumed that the factors of $n$ are balanced. The message is decrypted using CRT with small exponents but unknown to us, attacker. Is it possible to decrypt $c$ in such a scenario...
I want to implement Threshold Elgamal as described in section 6.3.1 and in the decryption phase each party must broadcast a sigma proof to show that it actually has a valid secret share of the secret key. I read about Schnorr protocol as a solution for sigma proof but it is said to be insecure, in chapter 5 of the sam...
When a function is iterated and each time a previous result is used as input to the next iteration (feedback), so that there is a limited benefit from parallel computing, is there such function that: requires polynomial time to get the result of N iterations has an Nth result that can be verified in constant time to b...
I've been reading about encryption and have a basic understanding of the concept. What I don't understand, however, is how a calculation with one key can result in a number that, through calculation with a different key, leads back to the same number you started with. Are they doing the same calculation (what I mean by...
I'm having a difficult time understanding a concept from interactive proofs: A trivial interactive proof for the graph isomorphism problem is having the prover just send a permutation that shows an isomorphism between $G_1$ and $G_2$, and have the verifier check it. But what happens when $G_1$ and $G_2$ aren't isomorph...
Objective: A verifier wants to ensure that a block of data M is also known to a prover. The protocol should exchange little information and should not leak information about the value of M. Proposed Protocol: V -> P: challenge c P -> V: response r = f(M, c) Question: What is a suitable and efficient function f? What co...
I'm writing a wrapper for a chat program to allow for end-to-end encryption. I'm using Python and PyCrypto to accomplish this. I'd like to use a well known library to do this, but to my knowledge, none exist that do what I'm looking for. Here's the design of the handshake protocol. Alice and Bob have previously gen...
Are there any authenticated encryption methods that combine encryption and authentication, rather than useing a separate cipher and MAC?
I'm thinking about the scenario of using a set of (potentially untrusted) hosts to store (potentially private) files. Think something like distributed backup where you contribute some disk space and in exchange you get to store N copies of your data in other nodes. The issue is how to combine key management + deduplica...
Given the following definition of a psuedorandom generator, I'm having trouble understanding what exactly the "distinguisher" D is outputting, and when?
I have this program which encrypts multiple files using AES then compress it using LZO into one single file. The problem is that the final file is almost equal in size than all the files which means LZO is not doing his job properly. Also, if I only encrypt files, the size is almost the same. I've also tried to compres...
Hardness of a subset sum problem depends on it's density. Is it possible for a subset sum problem to be intractable even if it's density is less than 0.9408?
Suppose we have a secret $\sigma$. The secret comes from a universe in which the elements are not necessarily distributed uniformly. We split $\sigma$ into $n$ shares $[\sigma_1,...,\sigma_n]$ (using Shamir secret sharing). So the order of shares matters. We know given all the shares in the right order one can recov...
I was looking at this image about OAEP: ..and was wondering what was happening here. We have a data block DB which consists of: lHash: What is this and where does this come from? PS: A string of zeros, but how much zeros? M: clearly our message. We have a seed which , is some random number. We put this seed into a ...
This question is related to this: When all shares of a secret are given to adversary as a permuted matrix I think the below question is a simplified version of that. Assume we have a 40-bit message $m$ (or 40-bit string). The message is picked from a universe of size one; so $m \in U$, where $|U|=1$. We permute the...
theorem: For arbitrary $i≥0$ there exists $m,n≥0$ such that $35+i=5m+9n$. We can use this theorem for constructing simple hash function. Let $M$ be message and $H(M)$ be its hashed value with hash function such as the $\text{SHA}256$. We construct new $n$ bit hash function $H'$ as follow: $H'(M)=5M+9H(M) \pmod {2^n...
Is it safer to give a non zero value to the most significant byte (MSB) of a cryptographic key to ensure its length (not 31 instead of 32 for an EC private key on a 256-bit curve for example)? Or is it counterproductive because it decreases the entropy? I ask the question for the MSB but it could be for several of the ...
Are there any known vulnerabilities in SHA-1 that can be exploited? Certain patterns that it shows? I recently performed a frequency analysis using 20,000 common words, and found nothing exploitable. What others techniques can I use to assert the security of SHA-1?
Suppose I have encrypted messages sent to a device authenticated with a MAC keyed with a strong shared cryptographic key. This device can only process so many messages per unit of time. This cryptographic key is renewed every few seconds: a new key is independently created and the previously one is destroyed. Does this...
In the key set up phase, server generates Pub=s.P, where s is the secret key.Then , it gives clients Pub,P as public parameters and pairing descriptions. Is it possible for clients to pre-compute r.P repeatedly until r.P=Pub so that r=s?