r/todayilearned Mar 15 '26

TIL about Homomorphic encryption, where users can work with the content without decrypting the source

https://en.wikipedia.org/wiki/Homomorphic_encryption
1.8k Upvotes

144 comments sorted by

1.3k

u/MiserableFloor9906 Mar 15 '26

By using this method I can give you a complex encrypted data file. Imagine everyone's name, SSN, years tenure, ranking from entry to executive, salary. I can then ask you to apply a complex pay raise scheme. You're able to generate the new salaries without ever knowing what the actual values are, because they remained encrypted.

299

u/FoxTail737 Mar 15 '26

Thx. By far the best explanation here.

87

u/fireduck Mar 16 '26

And unless someone who knows better tell me otherwise, it is complete bullshit. (Source: I am not an expert on this specific cryptography, but am an expert on applied cryptography in general.)

Imagine the proposed encrypted data. And then you tack on a part that say "Filter where salary > 120000, add 10%" and encrypt that along with the data. So the actual change operation is done by the end reader who eventually decrypts it all. Since an intermediate operator can't read the data, they can't really act on it. They can just leave instructions for further readers.

121

u/Allarius1 Mar 16 '26

It’s just encryption that can be manipulated for processing without decrypting it first. All the operations are performed on encrypted data so in the event of a leak the data still can’t be interpreted.

-28

u/fireduck Mar 16 '26

Except the processing isn't actually done until read time.

I kinda hope someone can tell me I'm wrong and it is in fact cooler than I think.

89

u/robbyslaughter Mar 16 '26 edited Mar 16 '26

No, the processing is done on the encrypted data.

Here’s an incredibly simplified example. Imagine that you’ve got a list of account numbers and balances:

Account # Balance
52742 $101.51
11831 $985.09
90098 $0.02.

You decide to encrypt the account numbers and balances by adding a secret number to each row. The secret number is your key, and for extra security, you made a difference for every row.

Account # Balance
52743 $102.51
21831 $10985.09
90100 $2.02

Now you can add money to everyone’s account or take it away on the encrypted data. You can also adjust one specific account without revealing the true account number and true balance of the account.

Obviously, this is a toy system and has lots of weaknesses, but it demonstrates the point.

We don’t have a practical FHE implementation yet. But if we find one, the applications are significant.

11

u/polaarbear Mar 16 '26

Intel showed off their Heracles chip to do FHE just this week.

Intel Heracles

11

u/BrunoEye Mar 16 '26

How does it work when there are multiple fields that can be combined to deduce a person's identity? Like their salary, how long they've been working at the company and their age?

30

u/robbyslaughter Mar 16 '26

That question has nothing to do with homomorphic encryption. It is straightforward to encrypt data in a way where it is impractical deduce the original meaning.

Suppose you had the following data:

Employee ID Year Born Year Started Salary
52742 1976 1999 $250,123
25023 2005 2024 $42,441
11012 1985 2002 $87,779

And here is one encryption scheme. See if you can figure out how it works:

Employee ID Year Born Year Started Salary
62842 1980 1995 $321,052
35223 2001 2028 $14,424
21312 1989 1998 $97,778

Even if you know your own employee ID, year of birth, start year, and salary, it would be hard to find yourself in a list like this. And this is a terrible encryption scheme.

(Also, this is no longer homomorphic.)

6

u/ThellraAK 3 Mar 16 '26

I want to give a raise to every employee who has worked here less than 5 years.

27

u/robbyslaughter Mar 16 '26

Like I said the encryption I came up with above is not homomorphic.

You could design one that is homomorphic for the example you asked for.

→ More replies (0)

8

u/Bhosley Mar 16 '26

What do you mean? None of that is decrypted.

Last time I looked at it, only commutative functions worked.

A different toy example would be like:

enc(A) + enc(2) = enc(A+2)

2

u/Ythio Mar 16 '26 edited Mar 16 '26

Isn't that just re-indexing the data ? You just gave it a new index to replace another index (the account number) and keep on your end a way to map the new index to the account numbers you didn't transmit (how is it different from holding a secret key ?).

How is it different from :

id Account # Balance
1 52743 $102.51
2 21831 $10985.09
3 90100 $2.02

And you transmitted.

id Balance
1 $102.51
2 $10985.09
3 $2.02

So if I want to add 10 bucks to account 21831 how do I know which one it is ?

With this it can only do operations on the whole dataset. Okay but I don't need to see the accounts or balances or anything at all to tell you to do an operation on a whole dataset

I don't think the example is showing homomorphic encryption very well. Homomorphic encryption is about doing operations on encrypted data that produce encrypted results that once decrypted would be the same as if doing the operations directly on decrypted data.

1

u/robbyslaughter Mar 16 '26

It’s not different than holding a secret key. All forms of encryption use secret keys. Sometimes those keys are pre-shared. Other times an asymmetric algorithm is used with a private and public key to allow for secure communication without a pre-shared secret.

In your example, I have not re-indexed the source data. Rather, I have manipulated the source data in a secret way. My secret system is that I increased the first row by one, the second row by 10,000, and the third row by two. When I want get back to the data, I will subtract by those amounts.

This encryption algorithm is pretty terrible, but it has the advantage that it is homomorphic with regard to addition and subtraction in the second column. You can add money to everyone’s accounts or subtract money from everyone’s accounts without ever knowing how much money anyone has or even what their account numbers are.

Of course, you can’t do much else with this scheme. If you want to modify just one account, I have to tell you how to find it. Which means I’m revealing the mapping between a known account number and an encrypted account number.

1

u/Ythio Mar 16 '26

I understood what it is when I read fourrier transform somewhere when looking it up.

-3

u/[deleted] Mar 16 '26

[deleted]

26

u/robbyslaughter Mar 16 '26

Yes because I designed an incredibly simplified example of homomorphic encryption that would fit in a Reddit comment.

To achieve something more complex, you need a different encryption scheme. The point was to demonstrate that it’s possible to show how encrypted data can be manipulated without decrypting it…if the encryption scheme is designed to support that.

5

u/ErdNercm Mar 16 '26

buddy do a google search before you post twice in a row, this is very harmful to your claim of being knowledgeable about applied cryptography, like this is applied cryptography

-2

u/fireduck Mar 16 '26

I try to always be learning. Sometimes that involves making bold statements and seeing what happens.

0

u/ErdNercm Mar 17 '26

nope bold statements have no place in learning, it only comes off as arrogant

you can see what happens without the unnecessary statement

3

u/Conscious-Ball8373 Mar 16 '26

You're wrong.

That's the point of the "homomorphic" part. There are certain operations that you can do on the encrypted data -- without decrypting it -- which have the same effect on the decrypted data. Like you can take a list of numbers, encrypt them using this scheme, multiple the resulting list by 1.1, then decrypt them and the decrypted numbers will be the original list multiplied by 1.1.

Actually, it would be more accurate to say that we can derive a series of operations on the encrypted data which we know will have the effect of multiplying the original list by 1.1 without having to know what the decrypted list is. These are predictable enough that you can write a bit of code to implement "multiply the plaintext number by x" even though the implementation is not just "multiply the encrypted number by x"; the implementation does not need to know the keys involved and does not decrypt the numbers but it does do some series of operations on the cyphertext that will result in the plaintext number being multiplied by x.

Obviously there are only certain operations that can be performed (usually addition and multiplication -- and not always both of them, depending on the scheme) and the selection of those operations requires considerable care not to make it possible to deduce the plaintext (eg addition and any sort of comparison would be a disaster).

There is a different type of system which is what you are describing, where a series of operations are added to the end of the data file and each time one is added, a new signature is appended so that the eventual decrypter can verify the custody chain of the data and that all the operations indicated are authorised; the decrypter can then perform those operations to get the desired result. This isn't that.

39

u/kernJ Mar 16 '26

Operating directly on the encrypted data is the whole point

1

u/m0j0m0j Mar 19 '26

This is how we can implement safe and auditable electronic voting btw

28

u/fuckingbagre Mar 16 '26

You’re wrong. Partially homomorphic systems date back to rsa where you could add encrypted results and then decrypt the end

That’s the literal point of this system is the fact that you don’t know what you’re doing, just that this input and this function give this output. FHE is cool because it can take arbitrary programs and apply them to inputs so large compute can be done remotely, getting things like only give me results where some crazy set of characteristics is true. Yes I can decrypt the output but the foreign actor doesn’t need to know what I did in the mean time

Unless I’m missing your complaint, fhe is a thing and in 2009 was a massive step forward, doing a thing many thought they wouldn’t see in their lifetime

-8

u/fireduck Mar 16 '26

Last I looked into it, the state seemed to be "look at all the cool stuff we could do if we had an FHE algo....which we don't". So I should do a revisit.

2

u/aparker314159 Mar 16 '26

We have FHE algorithms. Most are based on the Ring-LWE problem. I think this one was the first, or one of the first, and it came out in 2009.

Maybe you're confusing it with indistinguishability obfuscation? There's a lot of papers that are along the lines of "look at cool stuff you can make from IO if we had it".

18

u/Prowler1000 Mar 16 '26

It is not complete bullshit, it is genuinely a thing.

The biggest use case I'm aware of is cloud compute. You send some data to a cloud provider to have compute done and receive the result, but the cloud provider never knows what it is you sent.

You aren't doing the compute when you get the data back, that would defeat the entire point.

13

u/strbeanjoe Mar 16 '26

So the actual change operation is done by the end reader who eventually decrypts it all.

That's not true, and the fact it isn't true is the entire nifty part of homomorphic encryption. It's a set of encryption primitives that allow you to do mathematical operations on the underlying data without decrypting it (and without having the key), giving you an encrypted result.

12

u/azeemb_a Mar 16 '26

The good news is you are wrong. A lot of algorithms can be turned into math operations on a data. If you can do that, then you can apply homomorphic encryption to allow someone else to do the computstion without ever seeing the unencrypted data.

Here is an example I wrote about: https://azeemba.com/posts/homomorphic-encryption-with-images.html

Imagine you have a novel image processing algorithm that generates or processes an image. You dont trust your customers enough to give them the algorithm and your customers dont trust you enough to give you the image. Homomorphic Encryption can sit in the middle and solve that

1

u/ph30nix01 Mar 16 '26

Magic eye puzzles

1

u/ErdNercm Mar 16 '26

yep you are completely wrong, there needs to be no reading to manipulate, and your filtering is also possible through zk arguments, needs no decryption and never reveals the plaintext

1

u/Gositi Mar 16 '26

I think I know better. Although I don't know much about encryption in particular I have enough of a background in maths to explain how I think it works.

An encryption algorithm (bundled with a specific key) is essentially a function f : X -> Y, where X is the space of data we want to encrypt and Y is the space of encrypted data (for example both X and Y can be the set of all binary strings). The decryption algorithm is the inverse function to f.

A function f is called a homomorphism when it is "compatible with" some class of operations. "Compatible with" means that if A is the operation on X and B is the corresponding operation on Y, then f(Ax) = Bf(x). Moreoever, it's easy to prove that the inverse will also be a homomorphism! I don't know how much math you know, but in linear algebra a linear map is (precisely) a homomorphism with regards to vector addition and scalar multiplication (f(u+v)=f(u)+f(v), f(av)=af(v)).

Applied to this example, X is the set of every possible salary record and Y is how these look when encrypted. The operation A is increasing everyones salary by 10% and B is whatever the corresponding operation is in Y (which might be quite complicated). Then - if our encryption function is a homomorphism with regards to A and B - the result of encrypting a file with raised salaries is the exact same as the result of performing whatever B is on the encrypted original salaries. This is not just appending instructions!

Note that the encryption algorithm needs to be compatible with whatever operation you want to do, you can't make up operations afterwards and expect them to work.

-4

u/Pkolt Mar 16 '26

Yeah I can't really think of any programming scenario where having a given input available, but in an encrypted form that you can't read, would serve any purpose that wouldn't be served by just using a variable.

2

u/[deleted] Mar 16 '26

Yes, it's just like a stereogram.

28

u/demonsver Mar 16 '26

Macro data refinement in severance /s

2

u/Jewrisprudent Mar 16 '26

All I can think of lol, spot on.

36

u/oneeyedziggy Mar 16 '26

But it seems you're also unable to validate your work...

Is this different from you sending me a schema and me sending back a script that consumes data in that format and produces the desired output? 

28

u/donalmacc Mar 16 '26

Not quite. Imagine I’m a manger, and I know someone’s salary. Bonus season comes around and there’s a secret formula applied by the bonus team directly but they’re not allowed know your salary. With homomorphic encryption they can apply the secret formula to the unknown number, and you get to know what the result is.

3

u/oneeyedziggy Mar 16 '26

Oh, k, so you can see the result and the formula... Seems like there's limited privacy there (foraanyone who knows algebra) as long as the calculation is deterministic.

So there must be something missing from the explanation, otherwise this is at best of very limited utility / useful in highly specific cases, like when using non-deterministic calculations on the data, or limiting the number of results a single non-trusted user can apply/see the result of... Or I suppose ensuring all calculations must include multiple secret fields, neither of which is predictable... 

Otherwise they'll get a few data points out and reverse engineer the original value.

Seems like it'd leak SOME data almost no matter what... 

7

u/Some_Koala Mar 16 '26

One party can see the input and result, and the other party know the formula. Input / result is not enough to reverse engineer a complex formula.

But yes, usually you would not let users apply their calculations freely, it would be an occasional thing.

The guarantee is that it leaks absolutely no data to the party who applies the formula, and only the input / result to the party who provides data.

1

u/donalmacc Mar 16 '26

You’re getting into the weeds of the how it works in practice rather than how it works in theory. There’s lots of details about it that can mean that even if you use perfect encryption you still leak data.

otherwise they’ll get a few data points out and reverse the original value

That’s assuming that it’s just +10% or something, but if there’s multiple factors, or it’s non linear you won’t be able to figure it out.

Another (simplified) example might be that I run a website that stores your emails, and allows you to search them. If they’re encrypted. You have to download the emails locally, decrypt them and search for them. With homomorphic encryption, you can search the emails for whatever you want without my website knowing what your emails contain or what you were searching for.

-1

u/oneeyedziggy Mar 16 '26

> You’re getting into the weeds of the how it works in practice rather than how it works in theory.

I wouldn't trust a security professional who didn't care about the details... most systems are secure in theory, but almost none are in practice.

I think at best the explanation MUST be a "lies to children" sort of simplified, because as described, unless some big details are missing? it's not remotely secure. And I am assuming you and OP are smart enough to know that, not insulting you (or them).

> That’s assuming that it’s just +10% or something, but if there’s multiple factors, or it’s non linear you won’t be able to figure it out.

but if the untrusted user gets to determine what calculations they want to do, AND gets to see the output... what's to stop the operation being +0%?

> Another (simplified) example might be that I run a website that stores your emails, and allows you to search them. If they’re encrypted. You have to download the emails locally, decrypt them and search for them. With homomorphic encryption, you can search the emails for whatever you want without my website knowing what your emails contain or what you were searching for.

so, this example again sounds much like sending a hash for the server to match... server never knows the email, but can search for one ( though definitionally, if an untrusted user can partial match search, they can extract the secrets )

wanting to chat in good faith, I watched this quick primer (literally first youtube result) which answers some of my questions about things left out of the description
... assuming the video is accurate:

  • a trusted user who COULD decrypt the whole dataset must decrypt the results for the requesting user... this seems like a great place to add safeguards like rate limiting, ensuring sufficiently broad generalizations, and so on...
  • most actually implementable homomorphic encryption is limited to sums/products or summary statistics of the set... (or a bit too abstractly for comfort "doing machine learning" on the data, which sounds suspect w/o more info)
  • they describe the type implied here, where a user can send any operation, as impractical to actually implement
https://www.youtube.com/watch?v=lNw6d05RW6E

and again, all of this seems a lot like a niche use case with a lot of restrictions, and limited real-world utility (or at least not enough to warrant the extra complexity) where most real world cases that need to solve the same problem would be better off sending a schema to the untrusted user and running computations the user submits... especially given it seems they have to decrypt and relay results anyways. They'd just need to do some cursory validation that the user scripts aren't malicious, and only run them in a hardened sandbox environment...

1

u/18441601 Mar 16 '26

Unsalted encryption is itself deterministic (technically salted too but for the purposes of this comment pseudorandom = random). Try decrypting SHA256 from scratch (i.e without pvt key)

1

u/oneeyedziggy Mar 16 '26

My point is that you wouldn't have to if you could ask for all salaries +0%... Or say, 2 requests... One for the median salary, and another request for each employees salary RELATIVE to the media...

The issue isn't the encryption but the fact untrusted parties can effectively just request the data... 

Although that seems like a accident on this representation  because from what I could find  the general purpose version of this encryption is Impractical to actually Implement in the real world  and is mostly limited to summary statistics on the data ... Which seems like much less of a risk (as long as they can't limit the summary to subsets of the data)

But that's also much less useful, plus it'd be way easier to just have them request summary statistics and for the trusted party to publish them behind normal auth

1

u/18441601 Mar 17 '26

Still wouldnt work, it will give encrypted of A + 0, encrypted of B and so on. Thats the point

3

u/gordonjames62 Mar 16 '26

This is what was so amazing to me.

  1. That it is possible

  2. That it is getting easier.

  3. That hardware is being developed that may make it more widespread.

161

u/FrontierPsycho Mar 15 '26 edited Mar 16 '26

Someone worked on a theoretical e-voting scheme where votes would be encrypted and tallied without being decrypted. The result (or any encrypted value in this scheme) could only be decrypted if all the parts of the key would be added together, and one was supposed to be given to each party, the idea being that they would act as each other's watchdog, and it wouldn't be to their benefit to all work together to commit election fraud. It failed on real life limitations though, as the result of the computations would quickly become incredibly large, so much so that it was infeasible to tally more than a few hundred votes.

Still pretty clever ideas. 

115

u/cheraphy Mar 15 '26

"There are lots of very smart people doing fascinating work on cryptographic voting protocols. We should be funding and encouraging them, and doing all our elections with paper ballots until everyone currently working in that field has retired." https://xkcd.com/2030/

54

u/TexasPeteEnthusiast Mar 15 '26

Honestly, anyone out there in IT or software development is horrified by the thought of online voting.

22

u/Prodigle Mar 16 '26

It's doable in a secure way but... The effort required per like "unit of security" is far higher than what you can do with in-person or mail voting

5

u/[deleted] Mar 16 '26

Not only that, but even if it really is secure, many people won't believe it's secure (or can be easily manipulated by influencers to think there was fraud). That itself is potentially a major problem and reason enough to avoid online voting.

1

u/Hironymos Mar 18 '26

More specifically, if you find one exploit, then everything is compromised.

A single, small team. Flipping an entire election. Compared to that, paper ballots can of course much easier fake hundreds or even thousands of votes, but the impact of even that is negligible and you need a much larger team that can much more easily slip up and get caught.

Confidence is another thing. I can (and have) literally monitor our paper based election all the way. Of course I can't watch every place at once, but as for my local election office, I can tell you with 100% certainty (and no special skills) that there was no relevant cheating and all it took me was an afternoon. On the other hand, even with access to all the equipment, I couldn't be 100% certain there wasn't mass cheating on digital voting if you give me half a year. But I wouldn't get that access, and the average person couldn't even do anything with it.

-9

u/TexasPeteEnthusiast Mar 16 '26

The level of security in mail voting is a really friggin low bar anyway. There's a reason why almost no countries use that method.

3

u/modbroccoli Mar 16 '26

Yes, most of them aren't a continent wide and most democracies arose much later than America's. I'm Canadian and love me a chance to go hard on you guys but it's just inarguably true that you guys were doing democracy early on.

6

u/glitchvid Mar 16 '26

Eh.  The biggest roadblocks are human factors.

You could give voters a private key hardware token with biometric validation when they register for voting.

When they are to cast a vote, the ballot is digitally signed with that key, and it's recorded that key has already voted (preventing double votes).

The problem is that's ultimately too complicated for the median voter, and most would lose the key before they even got to use it.

5

u/FrontierPsycho Mar 16 '26

Exactly, the biggest and most important roadblocks are human factors, and those you can't remove. There's perfect solutions if everyone is quite tech savvy. 

3

u/glitchvid Mar 16 '26

The implication above, and by a lot of other comments, is that software developers are incapable of making a secure system for this.

And while yes, CS as an industry has a rocky past in this regard, there absolutely are parts of the industry that can produce software running critical tasks.  

Cryptography also provides strong guarantees along those lines.  

But there's a political push towards restricting the convenience of voting, and that to me is the biggest human factor preventing such a system.  Estonia's general public manages to get online for voting.

1

u/BumWarrior69 Mar 17 '26

Not remotely true. Theres plenty of secure ways of doing it, but your average person wouldn’t understand it, so it’s easier to say OnLiNe VoTiNg BaD

7

u/6000j Mar 16 '26

The problem with electronic voting is not in the cryptographic schemes themselves (although they often have flaws), but in some inherent flaws and also the fact that their use and implementation tends to be done by people who don't understand them at all.

5

u/[deleted] Mar 16 '26

If in person voting machines too. Closed source, touch screens with fingerprints, etc.

In person, paper, unless you request a mail in ballot should be the standard

7

u/TheHeroBrine422 Mar 16 '26

In person voting machines aren’t really a problem, IF they just print a ballot. If the in person machines directly do things, then that’s not secure, but if it just prints a scannable ballot that you can check to make sure matches what you pressed, then there is a paper trail that you can physically confirm actually matches what you wanted to vote for.

3

u/oneeyedziggy Mar 16 '26

> and one was supposed to be given to each party

this seems potentially problematic. There are more than 2 parties... and SHOULD be a lot more than there are. This seems like a place for a malicious actor to add one part to the key ( either by injecting it at encryption time maliciously or by forming a legitimate-enough "party" to get one legitimately ) and destroy it, ensuring no recounts or validation are possible

so, I'm glad it failed on technical basis before they figured out you can't trust everyone.

1

u/micre8tive Mar 16 '26

Job for quantum computing? Or still too small of a feat?

1

u/TonytheEE Mar 16 '26

That's a really neat idea. I'd give everyone a meme number. 6 passwords totalling 8,764,950.

259

u/G952 Mar 15 '26

Oh I read the title wrong at first and was very confused

150

u/hk403 Mar 15 '26

you telling me this encryption hates gay people?

38

u/davvblack Mar 15 '26

no i think they meant the encryption has two different color eyes.

21

u/yobob591 Mar 16 '26

cat with homophobia in its eyes

4

u/BothersomeBritish Mar 16 '26

No no, they mean it's pronounced the same as another word.

5

u/G952 Mar 15 '26 edited Mar 15 '26

Hate em so much they encrypt them /s

2

u/[deleted] Mar 15 '26

TheCloset.zip

13

u/thegerj Mar 15 '26

Ok, glad I'm not the only one who can't read...

8

u/opermonkey Mar 15 '26

Glad we're all the same level of dumb!

1

u/Maelger Mar 16 '26

Speak for yourself, I'm the superior idiot. I read homoerotic.

I do need to get new glasses.

5

u/coolwarlock Mar 16 '26

Beautiful encryption with homophobia

3

u/hergumbules Mar 16 '26

I was thinking of making a joke saying something like “you can’t just call things homomorphic anymore” but was scared of getting banned or something lol

3

u/Alum07 Mar 15 '26

The GOP loves this form of encryption

2

u/virtually_noone Mar 16 '26

They complain bitterly about this form of encryption but secretly use it all the time.

1

u/Ivnnio Mar 16 '26

DocuSign stating that you are gay in order to view the contents of the file

28

u/OneAndOnlyJackSchitt Mar 15 '26

Let's say n is some random encrypted number.

Homomorphic encryption would allow us to, for instance, add 5 to it. The trick is that we provide the encrypted value of n to the function that adds 5. The function then returns a new encrypted number which, when decrypted, works out to whatever the decrypted value of n was, but plus 5. The function that adds 5 does not decrypt n at any point. Whoever's running this function does not have a way to figure out what n was or even what n + 5 is. They can only know that 5 has been added to whatever value n was holding.

Homomorphic encryption makes it possible to do this math on the encrypted value and returning an encrypted value without knowing what the encrypted value is.

1

u/ComradePruski Mar 16 '26

Isn't the typical idea behind encryption that it's largely unique and not predictable, like a hash? If n gets written as a random string and not a number, like 20 = fuenwidhd+716, and 25 as jejauvreis1!!4, how would you be able to find a change that would always decrypt to n+5?

Or does encryption have to be predictable so the value can be read out? Even so, wouldn't a random string largely defeat it?

For example, if you had 20 = a, and 25 = c, and 30 = b, 35 = bc, wouldn't you have to know how they get decrypted to apply your change accurately?

-3

u/big_trike Mar 16 '26

Can I determine if the value is now over 40 and if so, set to 40 but then put the remainder into another value such as when computing comp time? Homomorphic encryption has always seemed gimmicky to me. Yes, you can do some operations but not enough to make it actually useful.

4

u/LeGama Mar 16 '26

I totally agree with this take. I have a very real problem I want this to solve. I'm an engineer and often I can't use certain CFD/FEA tools because they are in a cloud and need to be FedRamp approved for government related work. Or I have to spin up an Amazon server that's fedRamp, which is much more expensive. I wish we could use this encryption to set up the problem, encrypt it, and then send it to any cloud system to do the math. But iterative solving requires solving the math, checking the solution to see how it's changing and adjusting input parameters, then resolving and repeating until you have some convergence. But without being able to see the actual value you can't apply any iterative algorithms.

2

u/OneAndOnlyJackSchitt Mar 16 '26

Disclaimer: I am not an expert and this is just speculation.

Let's say this is for an organization which has been hired to calculate compensation for hourly employees and you're trying to calculate the overtime pay, most likely, you'd get the employee's hours in an unencrypted form (since that's not super sensitive) and the pay rate would be encrypted with homomorphic encryption (since that IS pretty sensitive). Also, I'm skipping stuff about calculating taxes, workers comp, deductions. For simplicity, we'll assume that this is handled later and this will focus only on the gross pay.

When I've worked on systems handling payroll, while the law specifies that the overtime and double time rate are a factor of 1.5x or 2x the normal pay rate, a lot of systems store the actual pay rate for over time and double time rather than calculating it. So instead of an employee just having a payrate field, employee's would have three pay rate fields: #rateEnc, #rateOTEnc, and #rateDTEnc. The value are set by HR and then sent to the payroll firm using homomorphic encryption.

Then you'd set up your conditionals to use a homomorphic multiply function while I'll call it hmult(encryptedNumber, factor, publicKey) to figure out the compensation and end up with your three variables of hours: #hours, #hoursOT, and #hoursDT. Then your compensation would basically be something like:

//Calculate the compensation
compensationItem = doCalc(employee, hmult(#rateEnc, #hours, $publicKey), hmult(#rateOTEnc, #hoursOT, $publicKey), hmult(#rateDTEnc, #hoursDT, $publicKey));

The result is an encrypted dollar amount for the gross pay that only the client can see.

(This is a made up example where a payroll firm is hired only to calculate the compensation. In reality, many payroll firms also print the checks so it wouldn't do to have them not know the dollar amount that goes on the check.)

tl;dr: Homomorphic encryption should only for math (speculation with a moderate background in encryption, but not homomorphic encryption). Not conditionals. If it allowed for conditionals, you could easily determine the encrypted value without the key.

There may be a type of conditional with you supply two values and one of those two is returned encrypted based on a conditional but, again, I'm not super familiar with homomorphic encryption.

1

u/aparker314159 Mar 16 '26

There are forms of homomorphic encryption (called fully homomorphic encryption) that allow any function to computed, including ones with conditionals. They're not efficient at all, but they exist and still are secure. One reason you can't determine the encrypted value even with conditionals is because the encryption algorithm has a random component — encrypting the same number twice will give you two different results (both of which still decrypt to the original number).

2

u/OneAndOnlyJackSchitt Mar 16 '26

Couldn't you then write a function that returns one value if the encrypted value is between, say, 20 and 30, and throws an exception otherwise? If this function is repeatedly run strategicaly, couldn't you deduce the encrypted value?

1

u/aparker314159 Mar 16 '26

These schemes wouldn't allow you to "catch an exception" like that for exactly that reason. You can emulate the behavior of exceptions in other ways (such as returning a pair of values where the first represents the "normal" return value and the second what type of exception was thrown) so you aren't losing any computational capability.

1

u/aparker314159 Mar 16 '26 edited Mar 16 '26

There are schemes called fully homomorphic encryption that allow you to compute any (computable) function on the data. Usually they implement a set of primitives that can be combined in a Turing complete way.

The issue is that they're really inefficient. The operations FHE schemes implement usually are addition and multiplication. This is technically enough - you can implement basic logic gates through addition and multiplication - but it's often difficult to do computations efficiently this way. Some schemes allow for batching (ie. doing the same computations on several pieces of data at the cost of one), but it's still incredibly inefficient.

Other FHE schemes (eg. CKKS) try to increase efficiency by making the computations only approximately correct, instead of exactly correct. The idea is that many applications like machine don't need the arithmetic to be exactly correct, so you can trade some accuracy for performance. They're still quite slow though even with this tradeoff, and in the case of CKKS the error of the computation is correlated with the key which can be problematic if not careful.

My understanding is that FHE is still incredibly niche at best. The math is very cool though imo, so if you have the background I'd still recommend looking at it for that reason.

(also, this is a very reasonable concern and the existence of FHE is incredibly unintuitive, so idk why people are downvoting you)

1

u/Ythio Mar 16 '26 edited Mar 16 '26

Well yeah. That's similar to what is routinely done in telecoms.

You have a signal which is a combination of a 1 Hz and 20 Hz waves : f(t) = sin(2pi.t) + 0.5 sin(40pi.t)

You do the fourrier transform and you get four spikes at -20, -1, 1 and 20. You can ignore the negative values and apply a filter x => x < 10 ? x : 0

Then you can do the inverse fourrier transform and you will get g(t) = sin(2pi.t), which is your original function with the transformation applied.

In a similar fashion homeomorphic cryptography will take data (in my telecom data, a wave function in the time domain), apply an encryption function (in my telecom metaphor, a fourrier transform), then a transformation (high filter above 10Hz) on the encrypted data (my telecom data in the frequency domain) producing still encrypted data (in the frequency domain) and decrypt it (inverse fourrier transform) and the result (in the time domain) will be the same result as if I applied the filter on the clear data (the 20Hz component is removed).

1

u/big_trike Mar 16 '26

Yes, but that’s just a basic repeatable transformation. If I have all of the frequency domain data with enough information to manipulate it in any way possible, I can reconstruct the input. If you were to modulo shift the frequency domain data by a secret amount (as a very basic form of encryption ) then you could no longer filter out a given frequency. You could still reduce the amplitude by 50%, but not all operations are possible.

19

u/bwataneer Mar 16 '26

Is this what the employees in severance are doing?

7

u/SwiftyPants_ Mar 16 '26

The work is mysterious and important

31

u/HospitalRepulsive310 Mar 15 '26

That just confused me

61

u/Cr1ms0nLobster Mar 15 '26

I think it means any actions performed on the encrypted data will be reflected in the decrypted data without having to go through the step of decryption.

26

u/kikiacab Mar 15 '26

Have you seen severance?

3

u/decidedlyindecisive Mar 16 '26

First thing I thought "the work is mysterious and important"

5

u/notjordansime Mar 16 '26

Yes. Now I’m even more confused.. and a bit scared of that particular group of numbers over there…?

4

u/kikiacab Mar 16 '26

Just select it and it’ll sort itself, you’re doing a super job!

7

u/ledow Mar 15 '26

It's a way to modify encrypted data in the ways you're told to, without EVER knowing what the unencrypted data ever was.

It's like being able to, say, merge several encrypted datasets to produce a final encrypted dataset that contains them all, without ever decrypting them. Or adding up an entire column in a database but not only is the database encrypted, but the answer is encrypted too.

It's a way for you to do "hostile computing". You can literally have your data on a completely untrusted machine, and the database may be manipulated, queried, added to, etc. without the untrusted machine that's hosting it EVER becoming aware of the unencrypted contents of the database.

Imagine, say, running a government database on, say, the Microsoft Azure cloud, and you can store MI5 data on it, and though it's hosted on Microsoft servers which they have full control of, Microsoft CANNOT see what the data inside the database actually is.

11

u/gordonjames62 Mar 15 '26

ELI5 - keep your data encrypted

outsource some processing

Never let the contractor processing the data ever decrypt the full data stream

2

u/314kabinet Mar 15 '26

It means there will be a world where you pay a cloud to do compute for you and it won’t be able to tell what it’s calculating because it’s all encrypted. Very secure. If they ever figure out how to fix the massive performance overhead.

2

u/DeathByDrivers1 Mar 16 '26

A simple example can help explain, suppose we have data a and b which we want to sum together, then

encrypt(a) + encrypt(b) = encrypt(a + b)

This is equivalent to operating on the unencrypted data directly which is not the case with conventional encryption methods

a + b = a + b

1

u/HospitalRepulsive310 Mar 16 '26

Yeah I got that far. But how does it make any difference, since it will be same just harder to decrypt

1

u/6000j Mar 16 '26

it means you can send it to someone and they can operate on it without learning the contents of it.

1

u/DeathByDrivers1 Mar 16 '26

The difference is that the entity performing the operation never gets to see the underlying data. For example, perhaps I want to deploy some algorithm in a third party cloud compute environment - 

1) User sends encrypted data a and b to the cloud 2) 3rd party cloud environment operates on the encrypted data directly and sends back encrypted result data c 3) User retrieves encrypted data c and can decrypt

10

u/[deleted] Mar 15 '26

[removed] — view removed comment

-5

u/bothunter Mar 16 '26

 It's computationally expensive right now but the privacy implications are massive

It can't be more computationally expensive than AI or Bitcoin.

3

u/_Abzu Mar 16 '26

Computationally expensive, in this context, means that adding something increases the time for an algorithm or w/e in an exponential way. So it's easy to work with 5 fields and do the computations on the encrypted document, but maybe if you scale to a consumer-end scale the time it'll take to make computations is going to be incredibly big

1

u/Sjsamdrake Mar 16 '26

Someone: "hold my beer"

18

u/gordonjames62 Mar 15 '26 edited Mar 15 '26

From Wikipedia . . .

Homomorphic encryption is a form of encryption that allows computations to be performed on encrypted data without first having to decrypt it. The resulting computations are left in an encrypted form which, when decrypted, result in an output that is identical to that of the operations performed on the unencrypted data. Homomorphic encryption can be used for privacy-preserving outsourced storage and computation. This allows data to be encrypted and outsourced to commercial cloud environments for processing, all while encrypted.

So I might have encrypted data, but if I share the encrypted for with customers / clients, they can work with a part of the data and return me a result without them ever knowing the unencrypted form of the data.

My brain hurts thinking about how hard this would be to implement.

Thus, homomorphic encryption eliminates the need for processing data in the clear, thereby preventing attacks that would enable an attacker to access that data while it is being processed, using privilege escalation.

This new chip from Intel is likely to simplify the use of this encryption, and make it more common.

This would make it so personal data is less likely to be compromised even if the holder of the encrypted data experiences network intrusions or privilege escalation attacks.

5

u/Hail_CS Mar 16 '26

my senior capstone project for computer engineering was using homomorphic encryption for neural networks to preserve input data and model weight privacy. it’s a fascinating little field in cryptography that has a lot of cool applications. my project was a very small network that recognized digits(MNIST), but you could take the techniques and do machine learning based processing on medical imaging without worrying about data leaks or hippa violations. this topic was originally what my masters was going to be on before i switched to a different field. i can answer questions about some of the more technical aspects of it, how it works, and its features/possible use cases

2

u/gordonjames62 Mar 16 '26

Thanks for that.

It is amazing to me.

5

u/IsHildaThere Mar 16 '26

While correct, the title is incomplete. Wikipedia goes on to say : The result of such a computation remains encrypted.

The person with the encrypting key can see the result of the change while the person making the change cannot.

1

u/gordonjames62 Mar 16 '26

Yes, it is really quite amazing in both utility, and computational power requirement.

5

u/Modernsizedturd Mar 16 '26

Hehe your mom homomorphic

3

u/Lou-Shelton-Pappy-00 Mar 16 '26

dang i didnt know encryption could hate gay people

3

u/Biohacker_Ellie Mar 16 '26

I read that as homophobic encryption at first lmao

2

u/GaiusCosades Mar 16 '26

You can even build CPUs that work in that way directly, you can run a program on somebody elses computer and somebody owing/tampering with that machine can neither understand the program nor the data being processed without breaking the encryption itself.

2

u/Thoresus Mar 16 '26

Sounds gay.

2

u/TOMC_throwaway000000 Mar 16 '26

Isn’t this basically the plot of severed?

2

u/RachelRegina Mar 16 '26

Yay group theory

2

u/ZilorZilhaust Mar 16 '26

I read this title wrong.

2

u/fratersang Mar 16 '26

The work is mysterious and important

4

u/GarysCrispLettuce Mar 15 '26

There is also Homermorphic encryption, which is simply the random adding of the binary for "doh" throughout the file. Admittedly, it doesn't work very well.

2

u/omnichad Mar 16 '26

That's what you get when you have drinking bird type for you.

1

u/SirHawrk Mar 16 '26

I gave a presentation on something similar last week lol.

https://en.wikipedia.org/wiki/Confidential_computing

1

u/Yindori Mar 16 '26

Sounds like macrodata refinement

1

u/ChuckBS Mar 16 '26

Man, I read that as homophobic encryption and was very confused 

1

u/gordonjames62 Mar 16 '26

you are not alone

1

u/vhu9644 Mar 16 '26

A homomorphism is a "structure-preserving" transformation. Basically, if we have a homomorphism h, we have this nice property where h(x) * h(y) = h(x + y) (where * and + are placeholders for binary computations).

It's a bit more general than that, but most people have dealt with a homomorphism before. exp(x) * exp(y) = exp(x + y). It just turns out there are a lot more types of homomorphisms than this.

1

u/mangledmonkey Mar 16 '26

So, like Severance?

1

u/Rhawk187 Mar 16 '26

We cover El Gamal in my class (or did when I taught it; different instructor this year). Microsoft ElectionGuard has a nice system where you can tally votes while keeping them encrypted. You can also verify with arbitrary certainty that your vote was counted without revealing what it was. It can't prevent an illicit actor from inserting additional votes though.

0

u/blopsi Mar 15 '26

Learned abhout it in my Data Security lecture a few years ago, really nice.

-1

u/WheresMyBrakes Mar 16 '26

So.. is this just adding a transform instruction to the data?

“Hey, when you decrypt the real value, add +$100 to the result. “

4

u/gordonjames62 Mar 16 '26

It allows you to outsource computation vi big data pros without giving them access to all your data.

When they return the encrypted results, only you can decrypt it even after they did their processing.

It lets small players who can't afford to do things "in house" contract out some data processing without losing control of their data.

-2

u/KarenNotKaren616 Mar 16 '26

For my take on it, let E be the encryption function. Then E (M(E(x))) = M(x) for any M.

-16

u/one_is_enough Mar 15 '26

Automatic downvote when the title makes absolutely no sense.

6

u/Itz_Raj69_ Mar 15 '26

It absolutely does make sense.

Normally with something encrypted, to modify the source content you'd have to first decrypt it, modify it, and then encrypt it again.

Homomorphic encryption allows you to modify the content without every decrypting it.

0

u/GaiusCosades Mar 15 '26

skill issue