Skip to content
Advertisement

Tag: encryption

How to just change type of string to bytes? python

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

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

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

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

Advertisement