News for hackers. Stuff that matters.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by fnordpiglet on Monday February 13, 2023 @08:55PM (#34784095)
Adding two numbers takes 7 seconds, so many many many

But - it’s a lot better than it has been for FHE. This is progress even if it seems absurd.

Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by squeaky-clean on Monday February 13, 2023 @09:35PM (#34784493)
I'm surprised the "capitalizing a 32 character string" example is actually one second faster than adding two 32bit integers. Still super slow, but I'm curious why. I'd assume that if the string_cap.cc example takes 256 wires, wouldn't add.cc take 64 wires?
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by j2kun on Monday February 13, 2023 @10:13PM (#34784778)
Short answer: string cap has more parallelism in the circuit. Depth is more important than total number of gates, and optimizers can decrease depth pretty well.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by squeaky-clean on Tuesday February 14, 2023 @02:08AM (#34786383)
Thanks (and Dylan18607). So to continue assuming, the number of wires specified is just the input/output, and the add.cc has more intermediate "wires"?
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by j2kun on Tuesday February 14, 2023 @12:06PM (#34792388)
It's more like: to implement add you need a ripple carry adder. You can't evaluate bit 6 until you've evaluated bits 1-5. So there's a nested dependence that makes the circuit deep. String cap, on the other hand, can be implemented in parallel by looking at pairs of characters independently. So that makes it into a parallel band of small circuits, which we can evaluate in parallelism. Also I think the capitalization routing affects fewer bits of a char (it's just toggling one bit in each char, IIRC).
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by anthk on Tuesday February 14, 2023 @01:30PM (#34793776)
It's faster to carry six glasses at once than having to carry them to some point one by one.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by squeaky-clean on Wednesday February 15, 2023 @09:58PM (#34814427)
That makes perfect sense, thank you! I also didn't know until today that capitalization in ascii is just the 6th bit. I thought it would have been doing 32 subtract operations. (I'll be honest I haven't written my own uppercase function since school haha)
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by Dylan16807 on Monday February 13, 2023 @11:16PM (#34785219)
Since it encrypts one bit at a time, does capitalizing even have to touch the 224 bits that don't change?

> wouldn't add.cc take 64 wires?

Plus another hundred intermediate wires. And it's doing more complicated operations, however much that matters.

Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by squeaky-clean on Tuesday February 14, 2023 @02:11AM (#34786401)
No idea lol! Though it says it works on all 32 bytes in parallel regardless of input size. I imagine ignoring the bits that don't change would be some sort of security vulnerability? You could probably work out some timing attack or entropy reduction otherwise? They state it should take the same duration regardless of the length of the input string or how much needs to be capitalized (all branches are executed even though many are discarded)
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by Dylan16807 on Tuesday February 14, 2023 @02:27AM (#34786491)
> I imagine ignoring the bits that don't change would be some sort of security vulnerability? You could probably work out some timing attack or entropy reduction otherwise?

Nah. The bits are hardcoded into the circuit to not change. That's part of the program, and the program is public information. Only bit 6 of each byte might change, and everyone knows it.

Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by squeaky-clean on Wednesday February 15, 2023 @09:44PM (#34814315)
Whoa, I never knew about the ascii 6th bit trick, I've never really considered capitalization wasn't some random offset. So that does make this circuit simpler than I thought it was, and there's the parallelism aspect. It's not so surprising now that it's faster than the add.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by TeMPOraL on Monday February 13, 2023 @09:13PM (#34784275)
I feel it's already at the edge of being useful in practice. Compute and memory are cheap, and we're wasting a lot of it - so even with overhead this big, simple calculations wrapped in FHE wouldn't be prohibitively expensive - and may just be useful enough to create new types of software systems.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by NovemberWhiskey on Monday February 13, 2023 @09:37PM (#34784514)
7 seconds to add two numbers; that's roughly, what, 10 orders of magnitude slower than without FHE? I'm not sure compute is that cheap.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by unshavedyak on Monday February 13, 2023 @10:08PM (#34784736)
It would be interesting to see a whole new generation of writing apps with hyper optimized code. We suddenly go back to the 1950s(?) in relative compute power for apps behind FHE.

Not sure what could be done with it at 7s though hah.

Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by gregschlom on Monday February 13, 2023 @11:05PM (#34785140)
An order of magnitude order of magnitude
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by fnordpiglet on Monday February 13, 2023 @11:53PM (#34785463)
It’s orders of magnitude all the way down
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by flangola7 on Monday February 13, 2023 @09:24PM (#34784386)
If all you need to do is handle a symmetric key exchange that you then use for everything else, that might be enough.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by sillysaurusx on Monday February 13, 2023 @09:53PM (#34784639)
This is tempting to believe, but unfortunately the dream is to be able to run applications on someone else's servers without them knowing what you're doing. That's when I lost interest in FHE. If you want to use it, you have to use it everywhere, and it's just too slow.

Hopefully I'm wrong about that.

Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by j2kun on Monday February 13, 2023 @10:15PM (#34784794)
I probably should have added: the backends used in the post are 3-ish years old and missing some of the latest features. We're working on integrating newer backends and taking advantage of the new techniques! The performance story is better than it seems from my article. Plus this doesn't have any hardware acceleration, another big topic on my agenda :)
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by aliqot on Monday February 13, 2023 @11:05PM (#34785143)
Hey no need to justify it here, this is really cool! The first few runs are always slow and ready for optimization. I am very optimistic for what this tech may do for medical records and similar industries.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by fnordpiglet on Monday February 13, 2023 @11:19PM (#34785240)
Yeah I’ve always wondered if FHE would benefit from asic level acceleration, or at least FPGA
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by DesiLurker on Tuesday February 14, 2023 @02:44PM (#34794859)
If you are going to do an asic (w/o data going to memory IO) then why not use regular encryption with codec on the SoC itself (like DRM content). that works just fine. IMO the main value here would be trust between unknown parties over untrusted medium.
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by fnordpiglet on Tuesday February 14, 2023 @10:22PM (#34799680)
The typical perceived use case is FHE in cloud providers providing highly sensitive compute in a multi tenant platform. In something like that full on hardware acceleration is key
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by DesiLurker on Wednesday February 15, 2023 @08:02PM (#34813488)
just noticed the response..

Not really, even in those cases you need to understand that bits in memory (ie.. everything past (&including) the SoC's IO pins would never see the data unencrypted. any decryption is handled within working cache on soc with secure context (typically on a secure OS vm). I dont see why a bunch of compute code wont work there. in fact you could go a step further and encrypt compute instructions too. then assuming you know what you are doing and dont crash the compute node will have no idea what ops you are actually doing on what data.

btw thats how DRM works (sans the last part).

Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by fnordpiglet on Monday February 13, 2023 @11:35PM (#34785339)
Great article btw
Re:Google’s Fully Homomorphic Encryption Compiler – A Primer by ricksunscreen on Monday February 13, 2023 @11:39PM (#34785378)
Binary TFHE (the scheme the Google compiler uses) is fairly slow and has very large public keys (like 100MB). However the advantage is that binary computation is very flexible and well understood. Additionally, TFHE supports fast (~10ms) bootstrapping, which allows you to perform an arbitrary amount of computation.

If you can live with the limitations of other schemes FHE can be much faster. On a single core of an M1 Macbook Air, multiplying 2 BFV encrypted 4096-bit values takes 4ms and adding them takes only 15us. Additionally, key sizes aren't horrendous (<500kB). One downside with this scheme are that bootstrapping takes minutes so it isn't really practical. This limits the amount of computation you can do before you exceed your noise budget and the ciphertext decrypts to garbage. The other downside is that arithmetic circuits make some computations far more difficult (e.g. comparisons).