from cryptography.fernet import Fernet def encrypt(message: bytes, key: bytes): return Fernet(key).encrypt(message) def decrypt(token: bytes, key: bytes): return Fernet(key).decrypt(token) key = Fernet.generate_key() # store in a secure location #ex) key is 'Fn1dPza4Gchl7KpPE4kz2oJEMFXYG39ykpSLcsT1icU=' message = 'This is scret string' #encryption enstr = encrypt(message.encode(), key) #decryption destr = decrypt(enstr, key).decode() print('input:', message) print('encryption:', enstr) print('decryption:', destr)
8/24/2019
python string encryption, decryption - example code
Subscribe to:
Post Comments (Atom)
-
refer to code: . import ezdxf import random import matplotlib . pyplot as plt # Random DXF file generator def random_point (): r...
-
π FREE License Plate Recognition API - No Credit Card Required! Want to try ANPR (Automatic Number Plate Recognition) / ALPR (Automatic L...
-
π§ AWS SAM Troubleshooting - Fixing pip/runtime and AWS CLI Issues If you're deploying AWS Lambda functions with SAM (Serverless Appli...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
This is Video capture example in ver. opencv 3.0 rc1. In 3.0, location of functions are little changed. In case of VideoCapture, we shoul...
-
Background subtractor example souce code. OpenCV support about 3 types subtraction algorithm. Those are MOG, MOG2, GMG algorithms. Det...
-
Created Date : 2011.2 Language : C/C++ Tool : Microsoft Visual C++ 2010 Library & Utilized : OpenCV 2.2 Reference : Interent Refer...
-
As you can see in the following video, I created a class that stitching n cameras in real time. https://www.youtube.com/user/feelmare/sear...
-
After training SVM, we should test the trained XML data is reliable or not.. The method to extract HOG feature is refer to -> http://fe...
-
RTSP(Real Time Streaming Protocol) is video streaming, it usually sent from network camera. VideoCapture function in opencv also can get r...
No comments:
Post a Comment