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)
-
Logistic Classifier The logistic classifier is similar to equation of the plane. W is weight vector, X is input vector and y is output...
-
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...
-
* Introduction - The solution shows panorama image from multi images. The panorama images is processing by real-time stitching algorithm...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
fig 1. Left: set 4 points (Left Top, Right Top, Right Bottom, Left Bottom), right:warped image to (0,0) (300,0), (300,300), (0,300) Fi...
-
Created Date : 2011.10 Language : C/C++ Tool : Microsoft Visual C++ 2008 Library & Utilized : OpenCV 2.3 Reference : SIFT referenc...
-
OpenCV has AdaBoost algorithm function. And gpu version also is provided. For using detection, we prepare the trained xml file. Although...
-
Proceed with the project to update the 2012 version, or that you must reinstall Visual Studio 2010. If you are using Visual Studio 2...
-
I once wrote the following article. http://study.marearts.com/2014/04/opencv-study-mat-point-access-method.html This article is a sample c...
-
Created Date : 2011.8 Language : Matlab Tool : Matlab 2010 Library & Utilized : - Reference : Multiple View Geometry (Hartly and Z...
No comments:
Post a Comment