instruction
stringlengths
32
27.2k
I am learning Hash Algorithms and in a presentation (PDF) about these algorithms I read that: Length of $h(m)$ much shorter then length of $m$. Now my question is: What if we talk about an empty string, is it true that hash length is shorter than the length of message? I searched the internet and found that: The...
Please watch this video it's very short. If you already know cryptography and really good at it please start from 3:51. I didn't understand the step at 4:39, can someone here to explain? Why is $16^{54} \mod 17$ is equal to $3 ^ {24\times54} \mod17 \equiv 1$? He just wrote that. Alice didn't knew bob's private number ...
I am doing a small project using elliptic curve in cryptography. My doubt is, can I directly convert a projective to a Jacobian coordinate system without using the affine conversion in elliptic curve cryptography? Actually, I am stuck at this point…
In normal ElGamal encryption, the encrypted message is a pair (gb, gabM) - that is, the actual "encryption" is simply multiplication by the shared secret gab. A common pattern with public-key encryption is to encrypt a symmetric key using PK, and then encode the actual message with the symmetric key. It seems to me t...
I've seen contradictory results. Sometimes hash functions are collision-resistant but not necessarily second-preimage resistant. I've seen this kind of things in papers from Bart Preneel: “Security Properties of Domain Extenders for Cryptographic Hash Functions” (See the chapter "Other Domain Extenders"). How that ca...
The Rijndael specification details the design choices for the s-box in section 7.2. They describe the choice of affine mapping as follows: We have chosen an affine mapping that has a very simple description per se, but a complicated algebraic expression if combined with the ‘inverse’ mapping. It can be seen as modular...
How to find out the method used to encrypt the string 123456 which results in the value: 6g9SkDLIKa8l2VhafFnHvg==?
I am looking for a standard hash function which satisfies the following property: A hash function $H(a,b) = F(h(a),h(b))$ with $h$ (within $F$) any standard cryptographic hash function and $F$ an associative function. Is there any standard hash function(e.g. RIPEMD-160, SHA1) for which I can easily implement the associ...
Many protocols use HMAC on messages that include a nonce, but they don't seem to do it in a consistent way. For example, in OAuth the nonce is in the middle of an URL-encoded key-value string, like this: POST&http%3A%2F%2Fexample.com%2Frequest&a2%3Dr%2520b%26a3%3D2%2520q %26a3%3Da%26b5%3D%253D%25253D%26c%2540%3D%26c2%3...
I want to store files in a secure manner (i.e. no one should be able to decrypt the contents of the file without the secret key) but I also want a diff tool to be able to show me which lines changed (let's assume that you can't learn anything about the content of the file by seeing which lines have changed). The idea i...
Theorem: Let $y$ be a quadratic residue in $\mathbb{Z}_N$* where $N=pq$. There are exactly four integers $x_1, x_2, x_3, x_4$ where $0 < x_1 < x_2 < \frac{N}{2} < x_3 < x_4 < N$ such that $y = x_i^2 \pmod{N}$ for $i=1,2,3,4$. The above theorem simply states that exactly two of the four roots must be greater than $\frac...
We have cryptography based on hard problems from number theory, like DDH. When we speak about symmetric cryptography with AES, a mode of encryption (CBC, ...), what is the type of problem ? What is the term used ?
I am trying to create a DTLS client finished packet, where I need to generate verify data for handshake hash is need. And here I want to know how to generate handshake hash. As of now I am doing like this: memcpy(hs_msg, client_hello_with_cookie+13, client_hello_with_cookie_len-13); len = client_hello_with_cookie_len-1...
We are planning to implement the time-stamping service (RFC 3161) using OpenTSA wanted to know: Does OpenTSA support PKCS-11 (Cryptoki) to talk to HSMs? BTW: I did not find documentation or much information on OpenTSA. It would be really helpful if you could comment on the support of PCKS 11 by OpenTSA.
I'm working with a third party protocol which employs AES-128 in ECB mode of operation to encrypt a packet composed of 16-byte blocks (it encrypts each block independently). I'm trying to determine if there are any reasonable attacks against the encryption. One of the plaintext blocks it encrypts has a 4-octet nonce fo...
I'm developing a authentication and authorization protocol for a Bluetooth device. The device should communicate with an Android app and needs to be able to authenticate the app during the connection phase. Some kind of secret or asymmetric pair is therefore needed to be shared by the app and the Bluetooth device. As ...
I know it's possible with work backwards from the output bits of an LFSR to determine its feedback polynomial in a O(n) fashion. I'm also curious if, given an LFSR state and polynomial, is it possible to quickly work out how far the LFSR state is from a given epoch state (eg: the all-ones state). The only sure-fire m...
I remember I read that a MAC can be considered as a PRF. Can a variable-length input keyed-PRF be considered as a MAC?
The following was going through my brain for the past week. If my thoughts are generally known to the cryptographic community would someone provide a link or two. Even if I’m making a classic newbie mistake. Cryptographic internal functions operating like $x=f(x)$ can be table lookup s boxes with the inverse s box as ...
Being new to software development and crypto in general, I thought I would write a simple p2p encrypted chat app using the otr protocol detailed here: https://otr.cypherpunks.ca/Protocol-v3-4.0.0.html However, I am having an issue calculating g^x and g^y. I have g =2 for a particular 1536-bit prime, as the protocol say...
I am currently gathering some test methods and test suites for random number generator qualities, and am a bit stuck at finding something feasible to test for n-dimensional equidistribution. As input I have an arbitrary amount of bits from that PRNG and a dimension N, and as output I want something like "I am reasonabl...
Is it possible to modify a homomorphic encryption scheme so that it can be CCA2 secure? From the definition of a homomorphic scheme, it seems that it is malleable, which would result in lack of CCA2 security. So, if we use the regular method to convert a CPA secure scheme to CCA2 secure scheme (using a hash of the mes...
The Feistel cipher algorithm produces a pseudorandom permutation with domain size equal to $2^{2m}$ (for some $m \in \mathbb{Z}^+$). That is, a one-to-one function $\pi$ of the set $\{0, 1, 2, \dots, 2^{2m} - 1\}$ onto itself. Furthermore, with so-called unbalanced Feistel ciphers, it may be possible (though I don't k...
I have a key that is the combination of two shorter keys generated by PBKDF2, which together are long more or less 64 bytes. Now I need to shrink it down to 32 bytes and I'm not sure what to use to do it. I was thinking of SHA256. I know that SHA256 is not safe to generate keys by itself, but since what I have is a com...
Short question: is there an algorithm for efficiently computing square roots in $\mathbb{F}_{2^n}$?
Can anybody show me (or point me to resource) how to generate public key and private key with simple math? Steps which can be reproduced in a simple calculator – so the message, keys all can be numbers for test. The values can be simple; it’s fine if it’s hackable. And how will you go about encrypting and decrypting t...
Is it mathematically possible to take a SHA256 hash and turn it into a 0-99 number where each number in 0-99 range is equally likely to be picked? As a 256 bit hash means the highest value possible is 2^256, this is not a nice or "round" number for the purposes of simplifying a hash down to ranges more natural for huma...
I'm evaluating different hash algorithms for use in my application. One of the kind of algorithms I am looking at are cryptographically secure ones to protect against DOS attacks. SipHash seems pretty great, but the creators seem very careful to not call it "cryptographically secure". In the SipHash paper (PDF), they...
I am looking into using AES256-GCM for encrypting some database fields. I know that for AES256-CBC, I need to generate a new IV for each encrypt, but I can use the same key. The IV can be openly stored alongside the ciphertext (ie, it can be public). I started to read about GCM, but I don't quite understand some thing...
So, I uploaded a text file in Cryptool and encrypted it with DES-ECB with the key FF FF FF FF FF FF FF FF. I encrypted the cipher text again, with DES-CBC using the same key. Then, I encrypted the obtained text with DES-CBC again. The first 8 characters match the encrypted text of ECB. The rest of it is different. I w...
If a user (other than the data owner) possesses the secret key in symmetric searchable encryption scheme are they able to run the trapdoor algorithm, or is this not publicly available?
Say we are able to decrypt a Elgamal ciphertext $c$ using only the public key. Apparantly it is now possible to solve the Diffie-Hellman problem (given $g^a, g^b$ calculate $g^{ab}$). How? I know how it works the otherway. When I'm able to solve DH, I found a way to decrypt Elgamal ciphertext. But I can't come up with ...
The other day I saw this Hybrid Cryptographic Algorithm in the Google and felt curious about it. I am trying to understand this Hybrid Algorithm. And hopefully its not so hard to understand whats going on until AES portion comes up. Here in this research paper the author gives 48bytes input to AES and gets 88byte outpu...
I'm developing a client/server system in Java which is not interacting with third-party software, so I don't have to worry about compatibility. At a certain point, I need the client and server to exchange a digitally signed value. I thought to use ECDSA, but I'm not sure what curve and what key length should I use. I'm...
I'm doing the Cryptopals challenges (formerly the Matasano challenges) and struggling with second part of the 49th problem where I'm asked to do the length extension attack with CBC-MAC without IV manipulation. There is a hint that I can simulate an IV somehow to do this but I don't understand. Can someone drop me some...
consider the field $\mathbb{F}_{2^4}$, defined by using polynomial representation with the irreducible polynomial $f(x) = x^4 + x + 1$. Given element $g = (0010)$ as a generator for the field, How are the powers of g generated? What are the steps to generate the binary values of $g^0$ to $g^{15}$ as follows? $g^0 = (00...
How come that in various articles about pairings I never saw anybody mention that there is a possibility to turn Type 2 pairing into Type 1 by setting $e' : G_2 \times G_2 \rightarrow \mu, (P,Q) \mapsto e(Tr(P), Q)$, where $e : G_1 \times G_2 \rightarrow \mu$ is Type 2 pairing and $Tr$ is the trace map? The only drawba...
Convergent encryption (CE), $E_k(d)$, is a way to encrypt the data $d$, with the characteristic that the encryption key $k$ is $k=h(d)$, where $h(\cdot)$ is a cryptographic hash function. Consider a cloud storage with client-side deduplication. The common procedures of uploading a file $d$ are to calculate and the send...
I would like to know what best steps are there in finding differences between a high order amount of merkle tree's or if a better associative structure should be used. I ask this questions because while i have found on comparing two trees for differences i have not found any specifics on comparing n amount at the same ...
I was going through these presentation slides (PDF) on Crypto 2013. It summarizes the paper, Factoring RSA keys from certified smart cards: Coppersmith in the wild. In the last slide, it was mentioned that one possible future work to be done is to use the “Adi Shamir's secret database of all primes” to attempt breakin...
Suppose you are implementing a Generalized Merkle Signature Scheme, using the Winternitz One-Time Signature Scheme for the node signatures. Furthermore, suppose the implementation is to be stateless (i.e. you don't keep track of which signatures have already been generated), meaning that you use a deterministic $Rand$ ...
There are two users $A$ and $B$ who are in different domain. Let's assume that $A\in KGC_1$ and $B\in KGC_2$. If they want to establish secure session, then they must run an identity-based authenticated key exchange protocol to get a shared secret key. To users, they can authenticate each other i.e $A$ is assured th...
I am studying the RSA cryptosystem. The public key consists of $(n, e)$, the modulus (product of two large primes), and the encryption exponent. I want to separate the modulus $n$ and exponent $e$. A typical public key is expressed in base64, and is of the following type: -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3D...
The paper Expressive, Efficient, and Revocable Data Access Control for Multi-Authority Cloud Storage contains the following simplification: $$e(C_i,\text{GPK}_{uid})\cdot e(D_i, K_{\rho(i),uid})\cdot e({C'}_{i}, {K'}_{uid,aid_k}^{-\text{GSK'}_{uid}})\cdot e(g, {D'}_i)^{-1} = e(g,g)^{au_{uid}\lambda_i}$$ I'm not able ...
How does Web Cryptography API (eg window.crypto.getRandomValues) produce secure PRNG? Specifications: https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#RandomSource-interface https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues How can the method be trusted? Or is it even...
in the Mr Boneh's online course is stated the following theorem: Let $G:K \to \{0,1\}^n$ be a PRG. “Thm”: if $\forall i \in \{0, … ,n-1\}$ the PRG $G$ is unpredictable at pos. $i$, then $G$ is a secure PRG. Moreover, according to his words, proving this is just a "puzzle" to prove, but actually I can't see it so e...
Can anybody explain how the below is true ? $I_n$ denotes the set of all n-bit strings, ${\{0,1\}}^n$. (..) Let $A$ be a finite field then the permutation $f_{(a,b)}(x) = a \cdot x + b$, where $a \ne 0; b \in A$ are uniformly distributed, is pair-wise independent. Thus, there are pair-wise independent permutatio...
I am getting to grips with cryptography as a total newbie, and am struggling with encryption "keys" and how to visualize them. From http://computer.howstuffworks.com/encryption.htm/printable: Symmetric-key encryption is essentially the same as a secret code that each of the two computers must know in order to decode ...
The other day when changing my password on a Solaris 10 system I was surprised that Solaris was able to detect that I hadn't changed enough characters between the new and current passwords. MINDIFF is the password security configuration parameter that specifies the minimum number of characters that need to be different...
An HMAC function is designed to verify message integrity, i.e., that the message has not been tampered with. It is generally (always?) implemented by using a hashing function H, and calculating the hash H(key + H(key + message)), where + signifies concatentation (Source). The key is secret, and is reused for multiple H...
In the first step of key generation phase in Paillier cryptosystem given here. It's given that $$\operatorname{length}(p) = \operatorname{length}(q) ) \implies \operatorname{gcd}(pq,(p-1)(q-1))=1$$ where $\operatorname{length}(k)$ = # bits in binary representation of $k$ $\operatorname{gcd}(a,b)$= greatest common d...
What is the computational time to break McEliece on a quantum computer? I've seen that polynomial time algorithms exist, but for special conditions. What about the general case?
I would like to implement the Rijndael subBytes() operation using calculation instead of tables, because I like to play with this on different wordsizes, as an academical exercice, to see what the table would look like. The first part is a multiplicative inverse in the polynomial binary finite field, isn't it? The $g: ...
I've just about done tinkering with an open source DRBG, and I sure would appreciate a bit of advice from this community. Here's the link to the project, hosted at codeproject.com. It is written in C#, the code is clean and well commented. The design criteria: The same seed must generate the same random output each t...
Is there any relationship between the RSA keypair standard and RSA security? Keypair: http://en.wikipedia.org/wiki/RSA_(cryptosystem) Security: http://en.wikipedia.org/wiki/RSA_Security If not, can anyone explain what RSA stands for (so I can keep the two seperate)?
When using PBKDF2, is there a practical upper limit to the iteration count above which we lose security? Note: If you answer “No”, that's fine. But if you answer: “There can't be an upper limit“, Consider the case of $2^{256}$ iterations using SHA-256.
I was watching a Stanford lecture on Vigenère cipher and in it the professor said that – to break the cipher – we assume the length of the key is known. We then break the cipher into groups of this known length and then pick up (successively) the first, second, etc. members of each group and then break each of these us...
Here is a somewhat silly and atypical problem I am currently facing. Usually, when it comes to hashes, one is bothered with finding collisions and preimages. My problem is, I need to find the IHV used to initialise the word buffers. The message and the hash function output are considered to be known. Is there a non-br...
Alice pays Bob $5/month to host a gigantic file for her. She wants to occasionally verify that Bob is actually hosting the file. To do this, she selects random blocks from the file, and challenges Bob to hash those same blocks with her chosen salt. The digests should match. This is a solved problem because Bob ...
In openSSL – during RSA key generation – if $q$ is bigger than $p$, they exchange them. Why is that?
I am doing a small project in ECC. I have used the following equation for converting Projective to Jacobian coordinates: $$D = AC\\ E = BC^{2}\\ F = C$$ and also the following equation to convert Jacobian to Projective coordinates: $$A = DF\\ B = E\\ C = F^{3}$$ where $(A,B,C)$ represents a point in Projective coordina...
The Wikipedia “Key Size” article states: The security of an algorithm cannot exceed its key length (since any algorithm can be cracked by brute force), but it can be smaller. … … … Most symmetric-key algorithms in common use are designed to have security equal to their key length. (emphasis mine) The book “Secure Pro...
It is possible to recover the public key from an ECDSA signature values $(r,s)$? Please explain how this works.
Does CCA security imply authenticated encryption?
In the answer to the question “What exactly is a negligible (and non-negligible) function?” There is a part in the explanation that – as far as my knowledge goes – is conflicting: But instead of brute force, the adversary can guess (a polynomial number of) random values and hope to chance upon the right one. From wha...
some authors claimed that computational performance of a pairing-fee scheme (based on scalar multiplication over an elliptic curve group) is about 1000% more efficient than a pairing based one I would like to know: is there any advantage for a pairing-based scheme?
I read the claim, without proof, that it is possible to construct a next bit predictor for any PRNG given an oracle distinguisher for that PRNG and vice versa. How do I prove that? A distinguisher takes a bitstring and tells you if it was generated by the PRNG or not. A next bit predictor takes a bitstring and tells y...
On the Diceware page is this little gem: For extra security without adding another word, insert one special character or digit chosen at random into your passphrase... Inserting a letter at random adds about 10 bits of entropy. By that statement, does that mean adding a random character to a random position in a Dic...
What is Attribute Based Encryption? has a nice explanation what both forms (Ciphertext-policy Attribute-based Encryption and Key-policy Attribute-based Encryption) are. My question is: what is the motivation/analogy behind Key-policy Attribute-based Encryption? CPABE can be regarded as a variant of Attribute-based Acc...
Knuth describes in "the art of computer programming part 2" an algorithm called "M" for mixing two streams of random numbers. This can be used to mix random number streams giving the assurance that the result is still random even if one (but only one) of the streams suddenly becomes predictable. Now I have a situation ...
I know there are way better and more tested encryption methods, but I was wondering if the following code could be use for symmetric encryption? var text = "hello"; var password = "mypass"; var message = hash(text) + encrypt(text, password); function encrypt(text, password){ var key = hash(hash(text) XOR hash(pass...
I'm reading through the XEX mode spec, and I want to make sure I've understood the $\alpha^j$ step correctly: $X = E_K(I) \oplus \alpha^j$ $C = E_K(M \oplus X) \oplus X$ where: $M$ is the plaintext message $I$ is the number of the sector $\alpha$ is the polynomial $2^n$ over the finite field $GF(2^{128})$ $j$ is the b...
I have written my own AES-128bit implementation in Java, till yesterday I thought it would be alright. (I was working on the encryption) Now I’m trying to decrypt my encrypted cleartext, but this fails.. So, I hope I can ask such questions on here.. My Cleartext is: abcdefghijklmnop This will be converted to the State ...
I'm studying this white-paper: http://jessekornblum.com/publications/di09.pdf The author says that using AES-CCM with the external key (highlighted in green at page 9, figure 4) and with the nonce at offset 0x3662B8 (highlighted in red, figure 5) you can decrypt the data at offset 0x3662D4. I don't understand how AES-C...
Protocol: Coin Flipping over telephone Hypothesis: Alice and Bob have agreed: a one to one function $f$ which is easy to compute $f(x)$ from $x$ and while given any value $f(x)$ it is nearly impossible to find any information about $x$. an even number $x$ in $f(x)$ represent HEAD and the other case represents TAILS. ...
Based on what mentioned in the paper "Pairings For Cryptographers" http://www.sciencedirect.com/science/article/pii/S0166218X08000449 the two inputs of a pairing map are two members of two additive groups on elliptic curves, while the output is an element of a multiplicative group on a finite field. I would like to k...
Given a (bad) modification of DSA where the hash function is the identity ($H(m)=m$), I am now supposed to design an attack. So $(m, (r,s))$ are given and I should be able to create a legit signature $(r',s')$ for a chosen $m'$ (of course $m'\neq m$). Since retrieving the private key $x$ doesn't work. My new approach i...
My understanding are these steps are necessary for symmetric cryptography to be IND-CPA: The adversary submits two distinct $M_0$, $M_1$ plain-texts to the challenger. The challenger selects one of them at random and encrypts it with the symmetric key and gives cipher-text C. The adversary has to guess which message w...
Does there exist a cipher that can be encrypted twice with two different keys and then decrypted twice using either key first? For example: Plaintext is "Lemons are great!" Encode with Key #1 Encode with Key #2 Decode with Key #1 Decode with Key #2 Result is "Lemons are great!" To my understanding TLS does something l...
How to calculate time and space complexity of ElGamal encryption and decryption as there are two exponentiation operation during encryption and one during decryption? Here is my code for encryption: for i=1:d pow=pow*g; y=pow%p; for j=1:r pow1=pow1*g; C1=pow1*g; pow2=pow2*y; C2=(M*pow2)%p; I t...
I'm implementing an entropy gathering program. For that I collect 2 bits from two gpio-pins connected to a random source. I whiten this stream of bits using the von Neumann decorrelation algorithm. Now 2 out of 4 cases I can't use the bits because of that whitening algorithm (e.g. when both bits are 0 or both are 1). T...
I plan on storing data, encrypted with AES256, where the first dozen bytes are known plaintext. ('Hello World!' for example.) Does having this known plaintext prefix weaken AES256? I do not care about modifications being made to the ciphertext, which result in modifications to the decrypted plaintext. I do care about ...
I am pretty new to cryptography and have a sample of GCM mode of operation for AES. PFB the code Cipher c = Cipher.getInstance ("AES/GCM/NoPadding"); final int blockSize = 96;//c.getBlockSize(); final byte[] ivData = new byte[blockSize]; System.out.println("IV :- "+new String(ivData) ); final Secure...
This is for a challenge at followthewhiterabbit.trustpilot.com: Knowns: The algorithm is AES (Rijndael) Blocksize: 128 Keysize: 256 You only need to find the first 6 bytes of the key, the rest are 0’s, so: [?,?,?,?,?,?,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] All bytes in the key has an integer value b...
I have a cipher text which is encrypted using AES-128 Algorithm. I want to know the following things to decrypt the cipher. IV (Initialization Vector) Padding Method Encryption Key How do I find the padding method used in the encryption?
How much time will it take to crack PBKDF2 while using a 9 character password? I'm not specifying any specific system or platform. If a brute force attack is made using the best ever super computer around how much time will it take to crack it?
Sakura specifies a tree hash mode for e.g. Keccak (SHA-3). Are there any reasons to use the Sakura tree hash mode in a Generalized Merkle Signature Scheme? It seems to me Sakura primarily solves a uniqueness problem with using tree hashes for large data when the depth of the tree is variable. Trivially, if Sakura mode ...
As in the title, given $g$, $g^{ab}$ are big elements in a prime group $Z_p$ and $b$ in prime group $Z_r$ ($p > r$, $g$ is one generator of $Z_p$). $a$ is unknown and also in $Z_r$, is finding $g^a$ a hard problem? update $a$, $b$ and $ab$ are group elements of $Z_r$..
Edit: I know this isn't really a one time pad (as pointed out), though I don't really know what to call it aside from just a pad, I guess. I have been reading around (mostly various stackexchange sites, wiki and a few blogs/forum posts) about encryption and various techniques. I have read that doing a pad using XOR isn...
It seems to me that padding oracle attacks are mainly a concern for users of CBC mode encryption. Question: are any other modes of operation vulnerable to padding oracle attacks? And if so, why? There was some discussion in the comments section of this answer with regards to ECB, but it didn't reach a conclusion. It wo...
I am doing a password manager in Java. But now I am VERY confused because of the encryption. There will be the program login, where the user types its password, and it compares to a SHA512 hash. If it matches, the user logs in, if it doesn’t, then the user doesn’t login. I think there is no problem at this point. And t...
To be clear, I have access to $H(S)$ and as many $H(S||K)$ as I want. Every string $K$ is known. Can I use the extra information to my advantage and try to deduce $S$, without requiring bruteforce? Or do you still have to bruteforce but try less combinations since you have more information?
I have been reading about attacks and many of them work on specific rounds of TripleDES but not on full TripleDES. Is there any attack except brute force that works on full TripleDES? (theoretical)
I was reading this paper. In the table-1 of the paper it says TripleDES (showing both 128bit and 168bit keysize) is vulnerable to Differential Cryptanalysis. It also says that AES (showing all three keysize) is strong against Differential Cryptanalysis. If AES-128bit is secure against Differential Cryptanalysis then w...
I have been reading up on the polynomial representation of the AES Sbox (PDF: “Essential Algebraic Structure Within the AES” by Murphy and Robshaw) and I can't get it to produce the correct output. Maybe I have a thinking mistake somewhere along the way, so here's what I did: I picked a random byte: 10010101. This co...
I've just come across this piece of code in Bouncy Castle's implementation of OCB Mode: if (N.length > 16 || (N.length == 16 && (N[0] & 0x80) != 0)) { /* * NOTE: We don't just ignore bit 128 because it would hide from the caller the fact * that two nonces differing only in bit 128 ...
Most descriptions that explain how streamciphers work (like the one on Wikipedia), tend to describe a model that boils down to a simple “$ciphertext = plaintext \oplus stream$”, where the stream is determined by a nonce and a key, while the plaintext and ciphertext do not affect the stream at all. On the other hand, s...
It seemed to me that the Bouncy Castle SecureRandom class for C#/.NET only uses DateTime.Now.Ticks as its seed by default. I was wrong, but wouldn't that be unsafe to do?
When doing encrypt-then-mac, I can choose to use a hmac as the MAC. For example, I could use a hash like SHA-256 or SHA-512 (by using it as a keyed hash) to create that HMAC. Does it increase security when choosing a hash with a larger bit-size? Is a HMAC based on SHA-256 weaker than a SHA-512, or doesn’t it really ma...
I'm very curious to know this and a bit confuses too: Suppose, I have two files encrypted using AES-128bit with keys PBKDF2-derived from the same password and the same salt. If an attacker does brute force attack (imagining that he finishes this) to crack the keys, I'm guessing he needs to run the attack once to get t...