I am using Fernet and want to setup a basic authentication system, So on signup, I generate a key for fernet using key = Fernet.generate_key() Then I store that key in my cookies, so that it can be called during log in, but doing so converts the type of bytes to string. Suppose my key was – b’BNdXABgpo_Y5PH3VNpSfAJo8Y7A-vdTTIN5WJxYRgpk=’ and when
Tag: encryption
Crypto module and Encryption method not working
Basically, my question is divided into two problems, first of all, I am having this problem when I try running this code [code below] and get an error, like this: The second problem is when I enter text, i.e: “My data is here” I got the encrypted text as : “GIdd+zxj8m0nMeh7wmZJ+Q==” but reversing the process in decryption it outputs a
How do I encrypt and decrypt files with Python fernet without getting TokenError?
I’m trying to make a login program that encrypts the login file when it’s not in use. The program keeps raising “InvalidToken” error. Does anyone know how to fix this? There might be some other problems with the code, so if you find any, please let me know as well. My code is below. I didn’t use all of the
My Python Caeser Cipher program stops shifting after 30
I created a function to split inputed string into list of words and then replace the letters in each word with its shifted counterpart but when I set the shift to over 30 it prints unchanged. Answer One useful trick here is to use the modulus operator (%). It will take care of the shift for you. Here is how
unable to use OAEP decryption in python
Here’s my code: Here’s the error I get: What am I doing wrong? I’m running Python 3.8.3. Answer The mgfunc parameter (3rd parameter) for the mask generation function is incorrectly specified in the posted code. According to the description of Crypto.Cipher.PKCS1_OAEP.new(): mgfunc (callable) – A mask generation function that accepts two parameters: a string to use as seed, and the
decrypt non alphabetical characters in python ceasar cypher
I found online a working script to try on ceaser cypher, I modified it a bit to be able to decrypt and it’s working well for both sides except one detail: whenever it’s a special character (non alphabetical) such as: , . ! () ect… it encrypts it like a letter (fine and normal I guess) but once decrypted, these
how do you ‘connect’ this source code with my tkinter python
hi am new to python and i have created a very simple encryption code and a simple gui with tkinter but i cant seem to ‘connect’ them together i tried so hard but i need help right now that is the encryption method and that is the gui Answer use the ‘command’ parameter in the Button widget to set it
AES encrypt in python decrypt in php
I am asking this because I don’t really know php but must to somehow manage with. I have encrypted data in python and need to decrypt in php (serversite). python encryption: this gives ‘rtVabOaDdf528T63xOhhww’ output, which is correctly AES encrypted. and php which encrypts and decrypts in other way: There is some issue with openssl_decrypt() function because of “iv”. Can
Translate encryption in python to node
Trying to implement these 2 functions from Python to Nodejs: This decrypt works (when I encrypt in Python, I manage to decrypt in node), but the opposite way fails. Any idea what is missing in the nodejs encrypt function? Answer If the following points are taken into account, the encryption and decryption of both codes run in all possible combinations
How to encrypt and decrypt pandas dataframe with decryption key?
I have a df with 300 columns but there is one column ID that I want to encrypt and allow anyone else with a key to decrypt if I give them the df as a csv. Is this possible? I know how to hash a column, but as far as I have read I can not unhash it or give