0

Today I discover a encryption method

Which

0 = 35

1 = 34

2 = 37

3 = 36

4 = 31

5 = 30

6 = 33

7 = 32

8 = 3d

9 = 3c

It's the encode of number 1 to 0 for the method

Can you please help me to find the name of the method?

1 Answers1

1

It's an xor cipher with 0x05 as key.

Looking in the ASCII table, the digit 0 is ASCII code 0x30. In binary, that is 110000. Your ciphertext result is 0x35, which is 110101 in binary. The difference is that third-to-last and last positions are flipped (1 becomes 0 or 0 becomes 1). This is indicative of an xor key 000101 (put a 1 in the positions that flip). Converting 000101 (or simply 101 since leading zeroes can be removed) back to (hexa)decimal, you get 5.

The shortcut to calculating the xor key given a ciphertext and plaintext byte, is to xor them together: 0x35 ^ 0x30 = 0x05

To confirm this, we can use any other value from your list:

0 0x30 ^ 5 = 0x35
1 0x31 ^ 5 = 0x34
2 0x32 ^ 5 = 0x37
...
9 0x39 ^ 5 = 0x3c

An easy way to convert between binary / hexadecimal / decimal is python: hex(0b110101) gives 0x35 and bin(0x35) gives 0b110101. Note that the 0b and 0x notations are just prefixes to indicate the number system (binary and hexadecimal, respectively).

Luc
  • 31,973
  • 8
  • 71
  • 135