# 🔐 Muragala Password Manager

Hello All 👋,

I wanted to quickly mention how the application works. Both C# edition and Python edition work the same way. It uses Fernet Encryption which is an advanced encryption method used to encrypt strings of data. It requires a key in order to encrypt data. However, since we want the user to enter their own master password, we do not generate a key, but we hash the password with a salt in order to generate a key.

The salt is stored in a file called `preference.en` as a dictionary of a JSON. It also contains a hash of the password so that we can verify that the password entered for login is correct. All hashing is done with SHA256.

A separate `database.en` file stores the passwords. It follows a structure as follows:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1656175414205/3XiMPvdX9.png align="center")

In order to decrypt it, we follow the following procedure:

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1656175459796/NMeXNglro.png align="center")

Regardless of whether C# or Python, the setup goes as above. Therefore data from one edition is cross compatible with the other.

For the Fernet encryption, in Python edition the [Cryptgraphy.IO library](https://cryptography.io/en/latest/fernet/) is used. On the C# application, this is done using [Fernet.net library](https://github.com/thangchung/fernet-dotnet) by  thangchung.

Cheers 🎉

**External Links**
- [Muragala Python Project](https://github.com/asankaSovis/password-manager-Python)
- [Muragala C# Project](https://github.com/asankaSovis/password-manager-CSharpLibrary)
