instruction
stringlengths
15
30k
I would like to know how to find multiplicative inverse over $GF(2^8)$? I know, how to multiply two numbers in $GF(2^8)$(for example I know that <code>0x1b</code>*<code>0xaa</code> equals <code>0x8c</code>) I follow [this][1] [1]: http://www.cs.rit.edu/~spr/gdn2010/sticky.pdf explanation, but I still don't under...
How to calculate AES log table?
(Note: I'm using hexadecimal numbers to denote AES field elements and decimal numbers to denote integers.) First of all, you have to fix a **generator** of the AES field's multiplicative group. There's quite a lot of them: 0x03 0x05 0x06 0x09 0x0b 0x0e 0x11 0x12 0x13 0x14 0x17 0x18 0x19 0x1a 0x1c 0x1e 0x...
(Note: I'm using hexadecimal numbers to denote AES field elements and decimal numbers to denote integers.) First of all, you have to fix a **generator** of the AES field's multiplicative group. There's quite a lot of them: 0x03 0x05 0x06 0x09 0x0b 0x0e 0x11 0x12 0x13 0x14 0x17 0x18 0x19 0x1a 0x1c 0x1e 0x...
I'm making a very simple encrypter in C# that's roughly based on the one-time pad. The user enters a key(password), converted to a seed for a pseudo-random generator, and the pseudo-random generator generates the numbers used to shift the characters. The decrypt process goes the same, but then in inverse. Here's t...
I'm making a very simple encrypter in C# that's inspired by the one-time pad. The user enters a key(password), converted to a seed for a pseudo-random generator, and the pseudo-random generator generates the numbers used to shift the characters. The decrypt process goes the same, but then in inverse. Here's the ps...
I'm making a very simple encrypter in C# which is basically a Stream cipher. The user enters a key(password), converted to a seed for a pseudo-random generator, and the pseudo-random generator generates the numbers used to shift the characters. The decrypt process goes the same, but then in inverse. Here's the pse...
Let's assume that everyone agreed on some elliptic curve and a public base point $g$ somewhere on the curve. When two parties Alice and Bob want to agree on a shared secret, they proceed as follows: - Alice chooses some random number $a$ and applies the curve operation to $g$, the public base point, $a$ times. She ...
I'm making a very simple encrypter in C# which is basically a Stream cipher. The user enters a key(password), converted to a seed for a pseudo-random generator, and the pseudo-random generator generates the numbers used to shift the characters. The decrypt process goes the same, but then in inverse. Here's the pse...
I'm implementing Paillier encryption and I'd like some recommendations about improving its performance. Firstly, I have to note the following: - I have already set g=1+n to get rid of one exponentiation. - I've been using the CRT to improve decryption. Nevertheless, the computation of r^n mod n^2 is rather...
To obfuscate data I made up this method on the spot without planning since the goal wasn't real encryption. At first I though this cannot be real encryption but after revisiting the code and reading on block symmetric encryption, and including R in the method, it seems that it is( looks like a stream cypher, OFB sp...
Is my method symmetric encryption?
For school (high school) I am writing an essay on elliptic curve cryptography. The assignment needs to include a practical part, so I decided to write a Python class for elliptic curves. This class is capable of performing elliptic curve arithmetic and can encrypt files using MV-ElGamal (although it is horribly slow). ...
What is a good way to demonstrate elliptic curve cryptography?
I know using homebrew encryption can be very dangerous as it is very likely to have many flaws in its design. The following concept is just for learning purpose in case anybody is getting red flags reading this. Hopefully this is the right place to ask. I have made up a block cipher and would like to know how I can ...
I am considering building a hardware RNG myself using cheap parts. Is this a good idea and safe enough? * Random sources: amplified Zener noise from one randomly chosen `1N4728A` Zener diode and amplified reverse current of a randomly chosen `SS9014` transistor. * Random stream generating: The two amplified signals...
How to roll my own hardware RNG?
I'm still new to Public Key Crypto. I'm trying to understand how is it that the private key is generated first in public key crypto? I would have expected that the private and public key to be generated at the same time as they would depend on each other. For example, in a Bitcoin wallet, I can choose a private key...
How/Why is the private key generated first in public key crypto?
The reason that one must be derived from the other is that the private and corresponding public key are *strongly related*: For instance, in RSA, the pair satisfies $ed\equiv 1\mod\varphi(n)$; in Diffie-Hellman, we have $A=g^a$; and so forth. Hence, it is just natural to start with with generating one part and deriving...
I'm still new to public key crypto. I'm trying to understand how it is that the private key is generated first in public key crypto? I would have expected the private and public key to be generated at the same time, as they would depend on each other. For example, in a Bitcoin wallet, I can choose a private key (bra...
Why is the private key generated first in public key crypto?
I was researching about how to encrypt with RSA. I understood everything but not the format of the private keys. In the phpseclib (RSA in PHP), you can import your private key (private.key format) and in the key file there is text like this: -----BEGIN RSA PRIVATE KEY----- MIIBOQIBAAJBAIOLepgdqXrM07O4dV/...
What is the SSL private key file format?
This [question][1] contains a great answer what adaptive security means, but I haven't yet found a proper definition what full security is. Does a stronger sense of security than adaptive exist or are those synonymous. If they are different, what is the difference? [1]: http://crypto.stackexchange.com/questio...
Is adaptive security the same as full security?
This [question][1] contains a great answer about adaptive security, but I haven't yet found a proper definition what full security is. Does a stronger security than adaptive security exist or are the two synonymous. If they are different, what is the difference? [1]: http://crypto.stackexchange.com/questions/...
This [question][1] contains a great answer about adaptive security, but I haven't yet found a proper definition what full security is. Does a stronger security than adaptive security exist or are the two synonymous. If they are different, what is the difference? If they are not different, why are they referred to di...
I've been studying digital signatures and hash functions recently, and I was wondering: Do hash functions exist which will never produce collisions?
I am solving the discrete logarithm problem modulo $N$. $N$ is a composite number, I found its factors — lots of small primes and two big primes ($> 2^{50}$). Does the factorization of $N$ somehow help me? I think I could compute the logarithm modulo each prime and then combine it, but I do not know how to do this exa...
Today I was having a discussion with my cryptography lecturer about the keyspace of a ROT-13 cipher. He argues that the keyspace is 0 because it doesn't have a key. Could anyone explain to me why the keyspace is 0 and not 1? I could understand if he said that it doesn't have a keyspace but I don't understand why it ...
What is the keyspace of ROT-13?
Bonus question, what is the formula to calculate this?
How many bits of entropy would I get from 300 coin tosses?
I've been experimenting with an NTRU open-source C implementation [here](https://github.com/NTRUOpenSourceProject/ntru-crypto/tree/master/reference-code/C/Encrypt/src) I've noticed something (potentionally) strange with a certain set of params: NTRU_EES1087EP2 (defined [here](https://github.com/NTRUOpenSourceProject...
What about the beautiful images on this page, [Certificate Binary Posters part 1][1] and [part 2][2]? I'd believe they would be useful in this case. [1]: http://www.cem.me/20141221-cert-binaries.html "cem.me" [2]: http://www.cem.me/20150104-cert-binaries-2.html "cem.me"
What's the difference between a statistical pseudorandom number generator (PRNG) and a cryptographic-strength PRNG? I've seen a lot of PRNGs that are proposed for statistical uses -- e.g., statistical simulation, games, that sort of thing. These statistical PRNGs include schemes like linear congruential generators,...
Difference between statistical PRNG and cryptographic PRNG?
I am aware of the requirement of an IV to be unique in CTR mode (http://crypto.stackexchange.com/questions/2991/why-must-iv-key-pairs-not-be-reused-in-ctr-mode). However I wonder if I can use an IV depending on the plaintext deterministically. This means, of course, that the whole encryption is deterministic, which is ...
What is the difference between CSPRNG and PRNG? Is there performance differential between them? **For example:** We use PRNG for key generation which is very expensive and CSPRNG for IV/nonce in block ciphers which is fast? What is the difference between the two types of RNGs?
Let suppose that we have to check a message that was written one second ago. The message is discarded immediately after having being checked. What "minimal" size for such a MAC is secure ? Thank you.
Imagine I have four files I want to encrypt. I have master key, and from that master key I derive four keys, one for each file: key1 = HMAC-SHA-2(masterKey, filename1) key2 = HMAC-SHA-2(masterKey, filename2) key3 = HMAC-SHA-2(masterKey, filename3) key4 = HMAC-SHA-2(masterKey, filename4) After ...
If the MAC is well designed and there is no better attack than guessing, the attacker can choose at least two attacks: a. Find the key for MAC and be able to sign any message. b. Guess (maybe randomly) a MAC of an arbitrary message. (If unsuccessful, maybe retry the attack.) The feasibility of attack _a_ depen...
I'm programming an elliptic curve cryptosystem and I'm having difficulty with decompressing points. The following information is from my project specification as to my understanding: Given a point $x$ and $y$, we can compress its representation since for every $x$ on the curve, there are two $y$s; one even and one o...
The key element in the definition of a PRG is the **observer** (aka distinguisher, algorithm, test) that the PRG is supposed to fool. > A statistical PRG fools a **specific set** of observers, whereas a > cryptographic PRG fools **all** efficient observers. In words, no matter how clever the observer were, it ca...
Could any kind of encryption method (AES, etc.) lead to data loss like in lossy compression? I'm interested if data (lossy compressed, lossless compressed, uncompressed) that is encrypted and decrypted will always come back in the same state as before the encryption process, no matter what encryption method is used. ...
I read a brilliant, three part article on Elliptic Curve cryptography ([one][1], [two][2], [three][3]). It was able to explain Elliptic Curves to me in a way that didn't require a math degree to understand. The crux of the article is in page two, namely, when it discussed the "dot" operation: >!["DOT" operation][...
I am trying to find a list or table of !!! safe primes !!! number i.e. the one that are based on the Sophie Germain primes i.e. N = 2p + 1 where p is also prime All i found till now is the following database [http://primes.utm.edu/primes/search.php][1] However the problem with that database is that all Sophie ...
I am trying to find a list or table of !!! safe primes !!! number i.e. the one that are based on the Sophie Germain primes i.e. N = 2p + 1 where p is also prime All i found till now is the following database [http://primes.utm.edu/primes/search.php][1] However the problem with that database is that all Sophie ...
I am trying to find a list or table of **safe prime** numbers i.e. the ones that are based on the Sophie Germain primes i.e. $N = 2p + 1$ where $p$ is also prime. All I found till now is [this database][1]. However the problem with that database is that all Sophie Germain primes in this database have at least 1000...
Here is a great video which shows principles for public key cryptography using colors, which makes it easy to understand for everyone: https://www.youtube.com/watch?v=YEBfamv-_do Now what you missed is that it is possible to generate a secret key, and give away something which enables encryption but not decryption....
I'm designing a data storage system that should be both able to deduplicate data that share the same encryption key, and be reasonably secure. I know that this kind of encryption quality can be achieved by using AES in CTR mode with a synthetic IV derived from the HMAC of the file chunk - so that the contents are de...
I know that a cryptographically secure hashing algorithm is required for proper message signing (SHA-1, or I think SHA-2 is the current suggested algorithm). However, why does the hashing algorithm necessarily need to be "strong"? Seeing as the hashing is done before encryption/signature calculation, wouldn't an at...
What security role does the hash play in digital signatures (RSA or DSA)?
What security role does the hash function play in digital signatures (RSA or DSA)?
Why are cryptographically secure hashes required for digital signing (RSA or DSA)?
Today I was thinking about exactly this. Is it possible, for a 32-bit LFSR e.g. x^32 + x^30 + x^28 + x^26 + x^22 + x^21 + x^20 + x^16 + x^14 + x^12 + x^10 + x^8 + x^7 + x^6 + x^2 + x^1 + 1 to generate two 16-bit LFSR which xor to each other generate the 32-bit sequence?
Today I was thinking about exactly this. Is it possible, for a 32-bit LFSR e.g. x^32 + x^30 + x^28 + x^26 + x^22 + x^21 + x^20 + x^16 + x^14 + x^12 + x^10 + x^8 + x^7 + x^6 + x^2 + x^1 + 1 to generate two 16-bit LFSR which xor to each other generate the 32-bit sequence? ________________________________...
I would like to create random Galois fields over G(2**8) with operators (*,^) where (^) is the standard XOR and (*) is a randomly defined multiplicitive operator. I have an algorithm in mind, but I suspect that it will not generate all possible fields. I know that all such fields are isomorphic, but differences are cru...
I would like to create random Galois fields over $G(2^8)$ with operators $(\otimes, \oplus)$ where $\oplus$ is the standard XOR and $\otimes$ is a randomly defined multiplicative operator. I have an algorithm in mind, but I suspect that it will not generate all possible fields. I know that all such fields are isomorphi...
I would like to know how to find multiplicative inverses in $\mathrm{GF}(2^8)$. I know how to multiply two elements of $\mathrm{GF}(2^8)$ (for example, I know that `0x1b`*`0xaa` equals `0x8c`). I follow [this explanation](http://www.cs.rit.edu/~spr/gdn2010/sticky.pdf), but I still don't understand the process. More ...
How to calculate AES logarithm table?
Let $e: \mathbb G_1 × \mathbb G_1 \rightarrow \mathbb G_T$ be an efficient bilinear pairing. Note that the pairing is symmetric (i.e., Type 1). The problem is, given $g \in \mathbb G_1$ and $e(g,g)^x \in \mathbb G_T$, for an unknown $x$, to compute $g_1, g_2 \in \mathbb G_1$ such that $e(g_1,g_2) = e(g,g)^x$ Is ...
Let $e: \mathbb G_1 \times \mathbb G_1 \rightarrow \mathbb G_T$ be an efficient bilinear pairing. Note that the pairing is symmetric (i.e., Type 1). The problem is, given $g \in \mathbb G_1$ and $e(g,g)^a \in \mathbb G_T$, for an unknown $a$, to compute $X_1, X_2 \in \mathbb G_1$ such that $e(X_1,X_2) = e(g,g)^a$ ...
I have two probably quite naive questions: 1) Why, exactly, is it so bad to have a fixed (or predictable) IV in CBC mode? An example would be great! 2) Given 1), why is a random IV better? And if the IV is "random", how are Alice and Bob boh supposed to know it? isn't the IV part of the key in that case?
I have two probably quite naive questions: 1) Why, exactly, is it so bad to have a fixed (or predictable) IV in CBC mode? An example would be great! 2) Given 1), why is a random IV better? And if the IV is "random", how are Alice and Bob boh supposed to know it? isn't the IV part of the key in that case? 3) Wh...
**New question**: I am working on a cryptographic scheme and I need to rely on the following problem, which I have nicknamed the *"Hybrid Decisional Bilinear Diffie Hellman (hDBDH)"* problem: > Given the tuple $(g,g^x,e(g,g)^y,Q)$ as input, the problem is to decide whether $Q = e(g,g)^{xy}$ First, has this pro...
I am working on a cryptographic scheme and I need to rely on the following problem, which I have nicknamed the *"Hybrid Decisional Bilinear Diffie Hellman (hDBDH)"* problem: > Let $e: \mathbb G_1 \times \mathbb G_1 \rightarrow \mathbb G_T$ be an efficient bilinear pairing. Given the tuple $(g,g^x,e(g,g)^y,Q)$ as inp...
Let $e: \mathbb G_1 \times \mathbb G_1 \rightarrow \mathbb G_T$ be an efficient bilinear pairing. Note that the pairing is symmetric (i.e., Type 1). The problem is, given $g \in \mathbb G_1$ and $e(g,g)^a \in \mathbb G_T$, for an unknown $a$, to compute $X_1, X_2 \in \mathbb G_1$ such that $e(X_1,X_2) = e(g,g)^a$ ...
Just wondering, are there any known inverse hashes / hash lookups in common hashes (md5, sha1, sha2, etc.) for the null string hash value? (i.e. bytes 0x00 00 00 00 00 ...) Or more specifically, for a 128bit hash (like MD5 or SHA1): <pre> HASH(x) = 0x00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 </pre> Obv...
Are there any known inverse hash lookups for the null string?
Microsoft has created an implementation of PBKDF1 in the `PasswordDeriveBytes` class. It can however generate more bytes than PBKDF1, which is limited to the number of bytes generated by the underlying hash function. How does the proprietary extension of Microsoft to PBKDF1 work?
How does Microsoft PasswordDeriveBytes work?
Is this possible? Yes. <br><br><br> Is there any existing solution which satisfies the above requirements? That depends on what you mean by "existing". [Trapdoored key generation](http://eprint.iacr.org/2002/183) can be used for that.
I'm looking for a convenient way to share a set of public keys across multiple services, while preserving privacy by preventing these services from tying the identity of these public key sets together across services. E.g. If I share my public key set with both Service 1 and Service 2, Service 1 and Service 2 should...
Key derivation of public key without knowledge of private key?
The following two cipher suites were reported by [Qualys SSL Labs](https://www.ssllabs.com/) as being 112-bit: * SSL_CK_DES_192_EDE3_CBC_WITH_MD5 * TLS_RSA_WITH_3DES_EDE_CBC_SHA However, all other references I can find say that they are 192-bit, which aligns with my understanding of 3DES EDE: three independent ...
The following two cipher suites were reported by [Qualys SSL Labs](https://www.ssllabs.com/) as being 112-bit: * SSL_CK_DES_192_EDE3_CBC_WITH_MD5 * TLS_RSA_WITH_3DES_EDE_CBC_SHA However, all other references I can find say that they are 168-bit, which aligns with my understanding of 3DES EDE: three independent ...
if a number is said to be a subgroup of a quadratic residue of Z∗p, can I affirm that it is a generator of a cyclic group ? ie, if an element g of order q in Z*p, and P is a prime say 7, can i safely assume that g can be 3? I am referring to this: http://crypto.stanford.edu/pbc/notes/numbertheory/gen.html Th...
I'm trying to undestand how it works and how to implement the algo described in [this paper][1]. The paper shows a methods to compute a modular multiplication where it is used multiplier with a resolution smaller than output resolution. For example if I want to do a modular multiplication with 2 1024 bits numbers I ca...
I'm having trouble location information about whether or not encrypting a file's header is *good enough*. The files in question are media files that range in size from 500mb to 4GB. If I had no performance or time constraints, I would simply encrypt the entirety with AES256. However, with my current implementation ...
How secure is file header encryption for large files?
I'm trying to undestand how it works and how to implement the algo described in [this paper][1]. The paper shows a methods to compute a modular multiplication where it is used multiplier with a resolution smaller than output resolution. For example if I want to do a modular multiplication with 2 1024 bits numbers I ca...
I'm trying to undestand how it works and how to implement the algo described in [this paper][1]. The paper shows a methods to compute a modular multiplication where it is used multiplier with a resolution smaller than output resolution. For example if I want to do a modular multiplication with 2 1024 bits numbers I ca...
I want to know which "block cipher mode of operation" does the experts use? I don't want to use ECB or CBC because add padding and padding mess up my code. So which one does the experts use. /Thanks
Which block cipher mode does the experts use?
There are some errors in the basic assumptions or in their descriptions. So, we start with the group $\mathbb{Z}_p^*$, with $p$ prime. This is a cyclic group with order $p-1$. > if a number is said to be a subgroup of a quadratic residue of Z∗p, can I affirm that it is a generator of a cyclic group ? First, a ...
i'm implementing DES in python and i've stumbled upon a problem i can't really find the problem, after debugging it i narrowed it down to this function, can anyone tell me if i'm implementing the DES function correctly or not? def roundFunction(s1,j,k,l): left = s1[0:32] right = s1[32:] for i in...
Is this possible? Yes. <br><br><br> Is there any existing solution which satisfies the above requirements? That depends on what you mean by "existing". [Trapdoored key generation](http://eprint.iacr.org/2002/183) can be used for that. <br> x is the chosen key generation algorithm, K$_{\text{priv}}$ and K'$_{...
Just wondering, are there any known inverse hashes / hash lookups in common hashes (md5, sha1, sha2, etc.) for the zero string hash value? (i.e. bytes 0x00 00 00 00 00 ...) Or more specifically, for a 128bit hash (like MD5 or SHA1): <pre> HASH(x) = 0x00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 </pre> Obv...
Are there any known inverse hash lookups for the zero string?
Suppose in a future version of x509 PKI, it is possible to limit the quantity of certificates being used, what would that look like? Please disregard if this has already been invented, but let me know if this idea holds any water: 1. The child CA sends a list of primes to the parent CA 2. The parent CA checks th...
Possible to use an accumulator to "license" or restrict the qty of certificates being used?
Suppose in a future version of x509 PKI, it is possible to limit the quantity of certificates being used, what would that look like? Please disregard if this has already been invented, but let me know if this idea holds any water: 1. The child CA sends a list of primes to the parent CA (the prime is the public ke...
Microsoft has created an implementation of PBKDF1 in the [`PasswordDeriveBytes`](http://msdn.microsoft.com/en-us/library/system.security.cryptography.passwordderivebytes%28v=vs.110%29.aspx) class. It can however generate more bytes than PBKDF1, which is limited to the number of bytes generated by the underlying hash fu...
What is the algorithm behind Microsoft PasswordDeriveBytes work?
Suppose in a future version of x509 PKI, it is possible to limit the quantity of certificates being used, what would that look like? Please disregard if this has already been invented, but let me know if this idea holds any water: 1. The child CA sends a list of primes to the parent CA (the prime is the public ke...
The password `P` in the Microsoft implementation is first encoded using UTF-8. The iteration count `c` defaults to the value 100, and the hash algorithm `Hash` to SHA-1. The output is identical to PBKDF1 up to the maximum output size of PBKDF1, which is the output size of the hash. After that the first-to-last hash ...
What is the algorithm behind PasswordDeriveBytes?
if a number is said to be a subgroup of a quadratic residue of Z∗p, can I affirm that it is a generator of a cyclic group ? ie, say i am looking for a number which is an element of order q in Z*p, and P is a prime and equal to 7, can I say that 3 is a generator of the P? I am referring to this: http://crypto.s...