/r/cryptography

Photograph via snooOG

For people interested in the mathematical and theoretical side of modern cryptography.

From Greek κρύπτω krýpto "hidden" and the verb γράφω gráfo "to write" or λέγειν legein "to speak".

Cryptography is the practice of establishing a secure connection between two parties in the presence of a third party whom you don't want to be able to read your messages.

Cryptographers design algorithms and protocols, which do exactly this (and many other things). They also use a lot of time looking for security holes in existing protocols to make sure they can still be trusted. This is called cryptanalysis.

If you want a formal introduction to cryptography, you should read An Introduction to Mathematical Cryptography. The creator of the sub also approve of the Udacity course Applied Cryptography - A Science of Secrets.


A combined karma of at least 10 is required to post or comment in this sub.


Cryptocurrency talk is only allowed if it's to discuss the cryptography subparts of it.


We won't do your homework for you. It is however allowed to help you understand material and or the questions.


we won't solve your ciphers unless you provide us with an algorithm. If anyone sends you a code or a cipher without telling you how they encrypted it, don't bother posting it on this subreddit - your post will get deleted. We redirect you to /r/breakmycode or /r/codes. Thank you for your understanding and for following the rules.


Related Subreddits:

/r/cryptography

76,749 Subscribers

0

homework help: is x^k mod 26 a cipher?

shot in the dark as I've been stuck on this question for a while (apologies if my English isn't good)

Question: assume a mapping of letters A-Z being 0 to 25 (A=0, B=1, ...), k > 1 would the function x^k mod 26 produce a usable cipher? if so, what values of k would be valid?

my current understanding ( please do correct me if I'm wrong) is that for a cipher to be produced ( 1 to 1 mappings of plaintext to ciphertext characters), the GCD(k, 26) has to be 1 (i.e. k has to be a co-prime of 26)

During class, I have heard our teacher hinting that there are 8 possible values of k where k < 26 that can be used as a cipher. However, the number of k values that are co-prime of 26 is 12 ( phi(26) ).

In a case such as k=3, (3 is coprime of 26) I see that there are collisions, where multiple plaintext characters are mapped to the same ciphertext.

What am I missing here?

thank you for reading this and i appreciate any help.

10 Comments
2025/02/01
18:00 UTC

0

How much "embedded" cryptography has?

When i look at the embedded skill trees, i always see things like AES, side channel attacks, reverse engineering, etc.

What are the ares cryptography and embedded intersect ? Do you think how easily one that started with embedded could transition to cryptography or vice versa ?

3 Comments
2025/01/31
18:09 UTC

4

Any generalization of RSA onto other groups/mathematical objects?

Hi folks! Among asymmetric cryptography algorithms (at least the most well-known ones) RSA stands out compared to Diffie-Hellman, ElGamal and many others. While DH and ElGamal are based on the discrete logarithm problem, RSA is based on the integer factorization problem. DH and ElGamal were initially formulated for the "modulo p" groups but were then generalized to other groups with discrete logarithms (most notably elliptic curves) and even other algebraic structures with problems similar to discrete logarithms. But I've never seen any generalization of RSA, at least in common literature. Do you have any links, any research papers on your mind that generalize RSA? Or is it so tightly connected to particularities of integer factorization that it allows no room for generalization beyond integers?

2 Comments
2025/01/31
15:37 UTC

2

Help appreciated for a newcomer

Hi all I am a embedded enthusiast and going to start in cryptography company in two weeks

My problem is that my whole knowledge about cryptography is AES. I am staring to panic. I dont know how i even got the role, whether i will like it or pivot back to embedded.

My options are:

  1. read applied cryptography book

  2. just rescind, burn the bridge, and start looking for general firmware roles

Also did anyone started with cryptography and pivoted to something else? My fear is that i wont like it/ not be good at it and then had to go through career change all over again

10 Comments
2025/01/31
12:19 UTC

4

Securing and transmitting SSN’s

Hi everyone, my team is looking for a way to securely transmit social security numbers to other partner organizations. My boss is looking into various hash algorithms, but my gut feeling is that this isn't nearly secure enough, given the tiny amount of entropy in a nine digit number. After I mentioned this, my boss said that we would just keep the hashing algorithm a secret and only share it if absolutely necessary, but this still feels risky to me.

In practice we just need a unique identifier for a bunch of students, but we want to create them in such a way that we can reproducibly create the same ID for each student. That's why we are considering hashing SSN's.

Does anyone have experience doing this? What are the best practices for securely creating reproducible unique identifiers that are cryptographically robust? Thank you in advance!

25 Comments
2025/01/31
12:17 UTC

2

Ratcheting for file encryption

Hi i cant find any answers so im going to ask her. Some of you definitely know the double Ratchet / signal encryption algorithm.

I was thinking would it makes sense to use ratcheting for file encryption too? It would increase the time to brute force a full file extremely right?

6 Comments
2025/01/30
23:54 UTC

0

Anti-forensic and secure messenger

It stores all message data exclusively in volatile RAM, ensuring that no logs are retained and messages are automatically erased when the server is powered down or restarted. This ephemeral storage, combined with client-side quantum-resistant end-to-end encryption and default traffic routing over the Tor network, enhances user anonymity. Additionally, Amnesichat includes defenses against traffic analysis, operates efficiently on cheaper hardware, and supports group chats with pre-shared keys.

Source code: https://github.com/umutcamliyurt/Amnesichat

4 Comments
2025/01/30
21:19 UTC

0

Cryptanalysis and kelptography

Any good lectures or books on the topic of cryptanalysis and kleptography ?
Preferably not very math intensive.

13 Comments
2025/01/30
01:34 UTC

8

Favourite paragraph from Sixth Chapter of "Demystifying Cryptography with OpenSSL 3.0" by Khlebnikov A. (2022)

Understanding the OpenSSL error queue

You can find more information on OpenSSL call error handling on the OpenSSL man pages:

$ man ERR_get_error
$ man ERR_GET_LIB
$ man ERR_error_string_n
$ man ERR_print_errors_fp
$ man ERR_clear_error

It is, of course, up to you how you are going to handle errors from the OpenSSL calls. But as a responsible programmer, you should not forget to process and clear the OpenSSL error queue after failures.

When is it better to clear the OpenSSL error queue – before or after the operation? Different people have different opinions on it. One opinion is that the error queue should be cleared after the operation because a responsible programmer should clean after themselves and not leak errors. Another opinion is that clearing the error queue before the operation is better because it ensures an empty error queue before the operation. I prefer to clear the queue both before and after the operation – after because it is responsible, and before because in complex projects where many people are contributing, one or more persons will sometimes forget to clear the error queue after themselves. Humans make mistakes; it’s the sad truth of life and software development.

4 Comments
2025/01/29
18:08 UTC

3

TPM Question: Unique primary seed(s).

Hi All

I am doing a bunch of reading on Trusted Platform Modules and have a reasonable idea of how they work. One logistical question I have is around the (unique) primary seed(s) that ship in every TPM. As I understand it every TPM ships with one or more primary seeds burnt into it (via something like an e-FUSE). Does anyone know if manufactures ensure no two TPMs ever ship with the same primary seed values? And does anyone know how long these primary seeds tend to be?

This is more a curiosity question than anything else. I know most TPMs ship with a bunch of anti-tamper protections so trying to do some reading of this seed would be hard (or would result in destroying the TPM). But I presume if you *could* work out the primary seeds you could create a virtual TPM that is an exact mimic of the original TPM which could allow you to decrypt secrets stored on the local storage. Which would be bad.

Any input appreciated!

7 Comments
2025/01/28
17:47 UTC

1

Is asymmetric encryption safe without a certs if you have exchanged public keys ahead of time?

Question title says it all. Debating between this and TLS-PSK.

17 Comments
2025/01/28
15:30 UTC

3

Mutual crush matching protocol question

Hello!

Apologies if this is the wrong sub or if these kinds of questions aren't allowed. I went out with a group of people (3 girls and 3 guys in a Japanese style group date) and ran into a real life problem which ticked my engineer brain for a logical solution (or a proof that it isn't possible). I had done similar problems back in a cybersecurity class back in college, but couldn't reach a solution for this and wanted to ask for your help!

In essence, we wanted to find out at the end of the night if there were any couples with mutual interest. The boys would close their eyes and the girls would get together and point to the guy they are interested in, and vice versa so that members of the same gender knew who was interested in whom, but had no knowledge of who the members of the opposite gender picked.

Is there some kind of zero knowledge proof/protocol we could have followed to figure out if there were any couples with mutual interest without releasing any additional information?
For example, if Girl A and Boy B both picked each other, they would match and everyone can know, but if Girl B had picked Boy C and he had picked someone else, no information about who she picked or didn't pick would be released (of course she would find out that he didn't pick her).

Can there exist a protocol that doesn't involve a 3rd party to solve this problem? Thanks c:

7 Comments
2025/01/28
15:15 UTC

1

Smaller Arecibo

The Arecibo message started with a section that was meant to signal the message was being read correctly, what’s the smallest sequence of bits that one could use to signal that a code is being decoded correctly?

(of course, smaller means it is more likely to be found on accident, maybe my question is “what is a good middle-ground?”).

6 Comments
2025/01/27
20:36 UTC

2

Could someone explain the basics of cryptography for me?

I've recently gotten interested in ciphers and cryptograms, mostly just because of the fact that i think its just kinda cool. I understand the basics (replace a with z, k with e), but I cant really understand all the complex math of keys and and algorithms. If its too long to explain, could you give a source that i could read? Thanks.

18 Comments
2025/01/27
16:39 UTC

9

Dieharder test result 11.2

My developer colleague is bragging that his hobby of programming an RNG generator got a Dieharder test result of 11.2 and he said it’s a big deal. Is it? Can anyone explain to me like I am a 10yo why it is (or not) a big deal? And why (or why not) he should be so excited about it?

10 Comments
2025/01/26
21:23 UTC

4

Fully Homomorphic Encryption Survey

Hi, please fill out Lattica's FHE survey https://forms.gle/UA4LrVKhkWgENeGS9. This survey gathers insights from industry experts about the current state and future development of Fully Homomorphic Encryption. Survey results will be widely available here and on social media. Thanks - your insights are super valuable!

0 Comments
2025/01/26
10:43 UTC

14

Got hit by ransomware. I have the payload

Lets say I have the payload for some ransomware and I can encrypt anything with it I would like to.

Would being able to craft a target file be useful in brute forcing the decryption against the original?

from the HHS.gov threat analysis report:

MedusaLocker uses a hybrid encryption approach. The victim's files are encrypted with an AES-256 symmetric encryption algorithm, and the secret key is encrypted with RSA-2048 public-key encryption.

15 Comments
2025/01/26
04:32 UTC

0

How ciphertext-attack-resistant is this algorithim for data encryption?

I made a encryption algorithim to better learn cryptography and i have been trying to find out how resistant against ciphertext-only attacks

[SRC in C on Github](https://www.github.com/Lithax/SEC/tree/main/src/sec.c)

it uses a block size of 512 bytes, with xor encryption and a custom byte shifting, there is also a custom non-linear key expansion

maybe you could share some insight?

4 Comments
2025/01/25
23:24 UTC

0

My brother fears for his life because he thinks he is being targeted- because he works in cryptography, he says. Delusional or possible?

We his family don’t know if he is having a schizophrenic episode, or if this field is actually dangerous. Please advise?

29 Comments
2025/01/25
22:48 UTC

1

ZK Proofs for blockchains

I'm trying to understand real-world use of zero-knowledge Proofs used for blockchains.

What I need clarified is for these layer 2 networks, is the blockchain state stored and updated off-chain?

Let's say we're using an erc20 token on a L2 network. How do you get the state changes from L2 to L1 or are they just new contracts that interact with L1 contracts?

If anybody has some resources showing real-world examples, please share!

2 Comments
2025/01/25
21:08 UTC

0

I'm looking for something better then AES-256 GCM

Hi, I don't know if this exists; however, I am looking for a symmetric cipher better than AES-256 GCM. I mean, I want more security. I have already switched from RSA to ECC because it's more secure, and I also want something to switch from AES to. I know AES is still secure today, but I still would like a replacement that is more secure and has an implementation in Go because I'm going to use this in an app I'm making.

8 Comments
2025/01/25
01:50 UTC

4

What's the Best way to run aggregated queries over encrypted data without decrypting it first?

Hello everyone, I am in the process of doing some research and need some help. I want to create a system where all the data will be encrypted and stored inside a database like Postgres or MongoDB or some other DB. I want to run aggregated queries over this data without decrypting it first. It should go something like this.

  • Data -> Encryption -> Database
  • Query -> Database -> Encrypted Data

I've done some research and found that there's a thing called Searchable Symmetric Encryption which fit my needs. But I can't seem to find any good resources on this topic. Tbh, I'm not even sure that this will even fit my needs. But I want to understand how if (If at all) it can be integrated with something like PostgreSQL or something like that.

Please gimme some pointers regarding this. Or share any resources that you thing might be useful. Thanks.

19 Comments
2025/01/24
15:54 UTC

7

Liboqs integrations of pkcs11-tool

I’m looking to work on a SoftHSM project where I try to generate hybrid implementations of PQC signatures with classical algorithms.

Is there any integrations currently available of the above?

0 Comments
2025/01/24
12:26 UTC

6

I’m a 7th-semester BS Mathematics student interested in cryptography. I’m looking for universities offering MS in Cryptography or Mathematics (with a focus on cryptography) and fully funded scholarships for international students. Any recommendations or advice would be greatly appreciated. Thanks!

3 Comments
2025/01/24
00:02 UTC

2

Is Ascon and Ascon80pq secure?

HI, I'm new here but I am trying to add some encryption to my apps and I wanted to know if Ascon and Ascon80pq is secure when used with SHA256 truncated, when compared to AES-256 bit GCM with SHA256? I also wanted to know if it was post-quantum?

11 Comments
2025/01/23
22:42 UTC

0

Power-law weighted multivalue substitution cipher

I am new to cryptography. Yet, a simple cipher often enters my mind.

It is a standard substitution cipher so that one letter is exchanged by another. Yet, the mapping is done via a multivalued function. We start with 128 ASCII characters and we encode them into the ~150k Unicode characters.

However, the function should take the power law nature of characters into account and map common ASCII characters to more Unicode characters so that each Unicode character is used in a similar rate.

The mapping is deterministic in the sense that a ASCII E will always map to the same N Unicode characters. Yet, the distribution of these N characters would happen via a uniform function.

The key for this cipher is then a dictionary with ~150 Unicode keys that translate to 128 values (or the other way around.

Is this remotely novel or interesting?

6 Comments
2025/01/23
10:40 UTC

Back To Top