# Theory of Ensuring Data Privacy

Learn some of the most commonly used techniques for ensuring privacy.

## We'll cover the following

In this lesson, we’ll cover some of the mathematics behind high-level concepts in data privacy. Like all the other theory based lessons in this course, there will be mathematical formulations and technical details provided.

There are various methods for guaranteeing some degree of privacy in a database. Some methods, which we’ll call **blankets**, offer an all-or-nothing approach that’s very useful in certain scenarios. However, for most situations, statistical methods that act more subtly, such as differential privacy, are much more powerful and customizable.

## Blanket methods

**Blanket methods** protect data with relative certainty but offer little flexibility. They’re useful in siloed conditions but are the absolute best if those conditions are true. If they’re broken, however, the data is laid bare and unprotected. They’re very much all-or-nothing.

### Encryption

**Encryption** involves converting plaintext (the raw data) into an unreadable format by applying a series of mathematical functions to it. **Asymmetric encryption **(or public key encryption)** **is the most common type of encryption because it requires two keys, a public and private key, to decrypt the message. One of the most common algorithms, RSA, is an asymmetric encryption method that is guaranteed to safeguard data. Here’s a brief walkthrough of RSA via analogy.

Let’s assume Alice wants to send a message to Bob, but there’s a malicious actor, Eve, who wants to intercept the message. Bob has a set of two mathematically related codes that he came up with. One of them is public, the other is private. He tells Alice the public code so she can take her message and encrypt it so that the message isn’t sent in plaintext. Eve also knows the public key, but since the message isn’t sent in plaintext, she won’t know what the message is—she only sees the message encrypted with the public key. The only one who can decrypt the message is Bob, who has his special secret key. Once he receives the public key-encrypted message from Alice, he can safely use his secret key to view the plaintext. The reason the public key is public is so that anyone who wants to send a message to Bob can simply use the same public key. However, if Eve ever learns the secret key, *all* messages sent to Bob can be intercepted and read.

Get hands-on with 1200+ tech skills courses.