-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from asetalias/encryption
Encryption and Decryption support added
- Loading branch information
Showing
5 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from util.encryption import encrypt, decrypt | ||
|
||
password = "Achintya" | ||
|
||
encrypted_password = encrypt(password) | ||
print(encrypted_password) | ||
|
||
decrypted_password = decrypt(encrypted_password) | ||
print(decrypted_password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from cryptography.fernet import Fernet | ||
from util.env import KEY | ||
|
||
def encrypt(password): | ||
cipher_suite = Fernet(KEY) | ||
enccrypted_password = cipher_suite.encrypt(password.encode()) | ||
return enccrypted_password.decode() | ||
|
||
def decrypt(encrypted_password): | ||
cipher_suite = Fernet(KEY) | ||
decrypted_password = cipher_suite.decrypt(encrypted_password).decode() | ||
return decrypted_password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters