cryptography – How to determine what type of encoding/encryption has been used?

This is very weak security on all fronts! The plaintext is P4$$w0rdP4$$w0rd and it’s encrypted using XOR encryption, with the key CdZ4MLMPgYtAE9gQ80gMtg==. This produces the ciphertext posted by the OP above, WeJcFMQ/8+8QJ/w0hHh+0g==.

To verify:

First, use xxd to get the underlying binary of the plaintext:

echo -n 'P4$$w0rdP4$$w0rd' | xxd -b -c16

This produces:

01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100 01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100

Next, base64-decode the key and use xxd to get the underlying binary of the key:

echo -n 'CdZ4MLMPgYtAE9gQ80gMtg==' | base64 -d | xxd -b -c16

This produces:

00001001 11010110 01111000 00110000 10110011 00001111 10000001 10001011 01000000 00010011 11011000 00010000 11110011 01001000 00001100 10110110

Now, XOR the two binary strings:

01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100 01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100  (plaintext)
(XOR)
00001001 11010110 01111000 00110000 10110011 00001111 10000001 10001011 01000000 00010011 11011000 00010000 11110011 01001000 00001100 10110110  (key)
-----------------------------------------------------------------------------------------------------------------------------------------------
01011001 11100010 01011100 00010100 11000100 00111111 11110011 11101111 00010000 00100111 11111100 00110100 10000100 01111000 01111110 11010010  (ciphertext)

Finally, use bc, xxd, and base64 to convert the binary ciphertext to base64:

echo "obase=16; ibase=2; 01011001111000100101110000010100110001000011111111110011111011110001000000100111111111000011010010000100011110000111111011010010" | bc | xxd -p -r | base64

This produces WeJcFMQ/8+8QJ/w0hHh+0g==, which is the ciphertext posted by the OP in the question above.


I apologize if this answer seems contrived. Admittedly, it is. Questions similar to this, where the poster provides only some ciphertext, and asks for some insight as to how that ciphertext could have been produced, seem come up quite frequently on security.stackexchange.com; and this question is often referenced as a duplicate to those. The point of this answer is to illustrate that questions of this nature are unanswerable, because there are infinite solutions to these types of questions.

cryptography – How to determine what type of encoding/encryption has been used?

This is very weak security on all fronts! The plaintext is P4$$w0rdP4$$w0rd and it’s encrypted using XOR encryption, with the key CdZ4MLMPgYtAE9gQ80gMtg==. This produces the ciphertext posted by the OP above, WeJcFMQ/8+8QJ/w0hHh+0g==.

To verify:

First, use xxd to get the underlying binary of the plaintext:

echo -n 'P4$$w0rdP4$$w0rd' | xxd -b -c16

This produces:

01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100 01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100

Next, base64-decode the key and use xxd to get the underlying binary of the key:

echo -n 'CdZ4MLMPgYtAE9gQ80gMtg==' | base64 -d | xxd -b -c16

This produces:

00001001 11010110 01111000 00110000 10110011 00001111 10000001 10001011 01000000 00010011 11011000 00010000 11110011 01001000 00001100 10110110

Now, XOR the two binary strings:

01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100 01010000 00110100 00100100 00100100 01110111 00110000 01110010 01100100  (plaintext)
(XOR)
00001001 11010110 01111000 00110000 10110011 00001111 10000001 10001011 01000000 00010011 11011000 00010000 11110011 01001000 00001100 10110110  (key)
-----------------------------------------------------------------------------------------------------------------------------------------------
01011001 11100010 01011100 00010100 11000100 00111111 11110011 11101111 00010000 00100111 11111100 00110100 10000100 01111000 01111110 11010010  (ciphertext)

Finally, use bc, xxd, and base64 to convert the binary ciphertext to base64:

echo "obase=16; ibase=2; 01011001111000100101110000010100110001000011111111110011111011110001000000100111111111000011010010000100011110000111111011010010" | bc | xxd -p -r | base64

This produces WeJcFMQ/8+8QJ/w0hHh+0g==, which is the ciphertext posted by the OP in the question above.


I apologize if this answer seems contrived. Admittedly, it is. Questions similar to this, where the poster provides only some ciphertext, and asks for some insight as to how that ciphertext could have been produced, seem come up quite frequently on security.stackexchange.com; and this question is often referenced as a duplicate to those. The point of this answer is to illustrate that questions of this nature are unanswerable, because there are infinite solutions to these types of questions.