-
-
Save Ilgrim/cc7f24ef854b4eb7dda94c21c46d6774 to your computer and use it in GitHub Desktop.
GPG Symmetrical Example
This file contains hidden or 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
| import gnupg | |
| gpg = gnupg.GPG() | |
| # cifrado simétrico | |
| vaca = gpg.encrypt("esto é unha proba", [], symmetric=True, passphrase='1234') | |
| print(vaca.data) | |
| # b'-----BEGIN PGP MESSAGE-----\n\njA0EBwMCPaDu/4KW8In40kYBvzWul1ccpl4+GP4YVZHv4ppEZ3JydNIKPQViMvhO\nIndNIr2/+3dKFqifBQdZQiAr4X3U3R0QKeWbi1XOcGecPoj5L90m\n=dHQ6\n-----END PGP MESSAGE-----\n' | |
| # descifrado | |
| boi = gpg.decrypt(vaca.data, passphrase='1234') | |
| print(boi.data) | |
| # b'esto \xe9 unha proba' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment