Question: Can I get help resolving this incorrect padding error? Function description: decodexorbase64(string, key) which takes the output of the previous function (xor'd string and base64

Can I get help resolving this incorrect padding error?

Function description:

decodexorbase64(string, key) which takes the output of the previous function (xor'd string and base64 encoded key) and returns the original string, in b' format

My code:

def decodexorbase64(code, keyb64):

keyoriginal = binascii.a2b_base64(key) stroriginal = binascii.a2b_base64(string) return (stroriginal, keyoriginal)

Issue:

print(decodexorbase64(b'\x02\x01\x04\x00\x03\x00Y^\x00', b'a2VybWl0 '))

Gives the error: binascii.Error: Incorrect padding

What can I write in my code to avoid this error?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!