Decrypt xor-encryption Your task is to take an encrypted string as input, and output the string decrypted, to reveal its hidden message.

The strings, both the input and output, will contain characters from this list of 64 ASCII-characters (note the leading space):

 !"#$%&amp;'()*+,-./0123456789:;=?@[\]^_abcdefghijklmnopqrstuvwxyz|~


These characters are assigned numbers, in the order they are listed above:

  ! " # $ % &amp;   ...
0 1 2 3 4 5 6   ...


So, space is number 0, ! is number 1 and ~ is number 63. These numbers can be represented in 6-bit binary code:

 :  0:  000000
!:  1:  000001
":  2:  000010
#:  3:  000011 
.. ...  ......
z: 61:  111101
|: 62:  111110
~: 63:  111111




The encryption is very simple:

I'll use eC for encrypted characters, and C for characters of the original string. C(n) is the n'th character of the original string, while eC(n) is the n'th character of the encrypted string.

You'll use the 6-bit binary representation of the characters. The first character will be eC(0) = not(C(0)). From there, all characters will be eC(n) = xor(C(n),C(n-1)).

Example:

Let's assume the input string is code. 


c is the 38th character (zero indexed), or 100110 in binary. The encrypted version has all bits flipped, so 011001 -&gt; 25 -&gt; '9' (again, zero indexed).
o is the 50th character, or 110010 in binary. xor(100110, 110010) = 010100 = 20 = '4'.
d is the 39th character, or 100111 in binary. xor(100111, 110010) = 010101 = 21 = '5'.
e is the 40th character, or 101000 in binary. xor(101000, 100111) = 001111 = 15 = '/'.


So, if the original string is code, the encrypted string will become 945/.



Test cases:

945/
code

,&amp;'8[14 =?;gp+% 2'@s&amp;&amp;c45/eg8?&amp;
programming puzzles &amp; code golf

;a$5$%0r?2@12dw6# lb-eg&amp;519nt%ot=9$@es@96+?;ga" 4*)&amp;ta56dp[?o#t%oh/"(&amp;?#ee![,+,/+fe4"
a $150 reward will be given to those sending account and pin# to hackers@steal_id.com

~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!~!#!'!#!/!#!'!#![!#!'!#!/!#!'!#!
 !"#$%&amp;'()*+,-./0123456789:;=?@[\]^_abcdefghijklmnopqrstuvwxyz|~
Jelly, 27 26 bytes

ØJḟ“&lt;&gt;`{}”ḟØAɓi@€_33^\96_ị


Try it online!

Alternate version, 22 bytes (non-competing)

Jelly finally caught up with other golfing langs and got a printable ASCII atom, so this works now.

ØṖḟ“&lt;&gt;`{}”ḟØAɓi@€’^\Nị


Try it online!

How it works

ØJḟ“&lt;&gt;`{}”ḟØAɓi@€_33^\96_ị  Main link. Argument: s (string)

ØJ                          Yield Jelly's code page, i.e., 32 non-ASCII characters,
                            followed by all printable ASCII characters, followed by
                            129 non-ASCII characters.
  ḟ“&lt;&gt;`{}”                  Filterfalse; remove the characters "&lt;&gt;`{}".
          ḟØA               Filterfalse; remove all uppercase ASCII letters.
                            Let's call the resulting alphabet a.
             ɓ              Begin a new, dyadic chain.
                            Left argument: s. Right argument: a
              i@€           Find the (1-based) index of all characters of s in a.
                 _33        Subtract 33, so ' ' maps to 0, '~' maps to 63.
                    ^\      Compute the cumulative bitwise XOR.
                            We didn't take the bitwise NOT of the first index,
                            which can be rectified by subtracting all results from
                            63. However, we must also add 33 to account for the
                            fact that the index of ' ' in a is 33.
                      96_   Subtract the results from 96.
                         ị  Index into a.