avatar Bite 264. Clamy Fernet

In this bite, you are going to get familiar with symmetrical encryption using the cryptography module and its Fernet class. A quick online search should get you up to speed on how to use it, but here's a quick run down:

We are going to be using a password with Fernet, so we will need to run it through some sort of key deriving function like PBKDF2HMAC, bcrypt or Scrypt. I will be using PBKDF2HMAC, so read up on how to derive a key with it.

Once you have the key, you will need to urlsafe base64 encode it. This is what you will pass to the Fernet class when initializing it. Once you've done that, you will be able to encrypt and decrypt any text/phrase that you pass to it.

Further details can be found on the link that was provided for Fernet above.

Login and get coding
go back Intermediate level
Bitecoin 3X

Will you be Pythonista #47 to crack this Bite?
Resolution time: ~86 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 7.5 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help