It's a million dollar tech headache...caused by the U.S. government.

The New York Times today writes about how companies like Google (GOOG) are spending millions to beef up encryption of their own internal data. Why? To keep the National Security Agency (NSA) from hacking "their systems without their knowledge or cooperation." Those first reports about NSA spying surfaced last June but the fallout continues.

Related: Did Obama Just Destroy the Internet?

And The Daily Ticker's Aaron Task points out the irony. "This is the government essentially circumventing whatever agreements they had with these companies and finding a loophole. And you could argue that they've done these companies a favor by saying you guys are vulnerable here... the folks at Google have come out publicly and said 'we are outraged at the lengths to which the government seems to have gone.'"

And that leads us to the paradox of all this private information collection. Tech companies like Google, Facebook (FB) and Yahoo (YHOO) -- our parent company -- are now working harder than ever to protect their data from hackers and the government so they can make money off that same data to sell personalized ads.

The New York Times details some of the new efforts by big tech:

Google, for instance, changes its security keys, which unlock encrypted digital data so it is readable, every few weeks. Google, Facebook and Yahoo have said they are increasing the length of these keys to make them more difficult to crack.

Facebook also said it was adding the encryption method of so-called perfect forward secrecy, which Google did in 2011. This means that even if someone gets access to a secret key, that person cannot decrypt past messages and traffic.

More than anything, tech company executives are mad. Here's Facebook CEO Mark Zuckerberg talking to TechCrunch in September:

“The government blew it,” he said. “The government’s comment was, ‘Oh, don’t worry, basically we’re not spying on any Americans.’ Right, and it’s like, ‘Oh, wonderful, yeah, it’s like that’s really helpful to companies that are really trying to serve people around the world and really going to inspire confidence in American Internet companies.’ ”

The Daily Ticker's Henry Blodget points out: "If nothing else, [Edward] Snowden has succeeded in just completely embarrassing the United States government."

More on the NSA from The Daily Ticker

Is NSA Leader Edward Snowden a Hero or a Traitor?

Edward Snowden is "Heroic" Says David Stockman

Edward Snowden to America: 'Catch Me If You Can'