Very simple password encode and decode

Advertisements

I want a very simple password encryption that doesn’t need to be secure

I currently encode the password with

import base64
passwd = "test"
passwd = bytes(passwd, "UTF-8")
passwd = passwd.hex()
passwd = bytes(passwd, "UTF-8")
passwd = base64.b64encode(passwd)

if i set "test" as input the output is "b’NzQ2NTczNzQ=’"

I’m having problems reversing this. So far i have tried the folloving

import base64
passwd = "b'NzQ2NTczNzQ='"
passwd = base64.b64decode(passwd)
passwd = str(passwd).replace("b","").replace("'","")
passwd = bytes(passwd, "UTF-8").hex()

But the output of that is "3734363537333734"

>Solution :

You just reverse each step.

import base64
passwd = b'NzQ2NTczNzQ='
passwd = base64.b64decode(passwd)
passwd = str(passwd, "UTF-8");
passwd = bytes.fromhex(passwd);
passwd = str(passwd, "UTF-8");

Leave a ReplyCancel reply