mohammedjs
(Jaffar Siddiqui)
February 20, 2024, 2:08pm
1
Hi Team,
I need to create python script to decrypt sample input data to get appropriate out. Can anyone please assist. (First column in sample is in encrypted form and needs to be decrypted as below )
Input sample data:
9173810AB115CF3F037F4CCE642E8549,05-JUN-19,16-JAN-24
Expected output
233945335,05-JUN-19,16-JAN-24
I am trying to use below logic but its not working as expected.
pythons script
def decrypt_caesar_cipher(ciphertext, shift)
plaintext=‘’
for char in ciphertext:
if char.isalpha():
shifted_char = chr(((ord(char.lower()) - ord(‘a’) - shift) %26) + ord(‘a’))
plaintext += shifted_char if char.islower() else shifted_char.upper()
else:
plaintext += char
return plaintext
s=decrypt_caesar_cipher(‘ciphertext’, 1)
print(s)
Jaffar Siddiqui:
def decrypt_caesar_cipher(ciphertext, shift)
plaintext=‘’
for char in ciphertext:
if char.isalpha():
shifted_char = chr(((ord(char.lower()) - ord(‘a’) - shift) %26) + ord(‘a’))
plaintext += shifted_char if char.islower() else shifted_char.upper()
else:
plaintext += char
return plaintext
s=decrypt_caesar_cipher(‘ciphertext’, 1)
print(s)
Please put the code in a code block see this markdown tutorial . And please add the output you are currently getting with your function
1 Like
MRAB
(Matthew Barnett)
February 20, 2024, 2:33pm
3
A string encoded with a Caesar cipher should be the same length as the original string, which is the case with your function, but the input is clearly longer than the output, and it doesn’t look like a Caesar cipher anyway.
Sorry my mind is cooked right now I just can’t think straight
Rosuav
(Chris Angelico)
February 20, 2024, 4:05pm
7
This is 32 digits of hexadecimal, or 128 bits of data. It could be a block of AES-encrypted data, or an MD5 hash of the data, or something like that.