## Curious Question About Unknown Data

From: andrew cooke <andrew@...>

Date: Sun, 1 Sep 2013 19:52:58 -0400

http://stackoverflow.com/questions/18560948/encrypted-string-by-unknown-method

if ctext is the given text, then my code so far (python 3) is:

from base64 import b64decode

ctext = b64decode(ctext)

from binascii import hexlify

print(hexlify(ctext))

def bcd(bs):
for b in bs:
yield b >> 4
yield b & 0x0f

digits = list(bcd(ctext))
print(max(digits))
print(len(digits))

from collections import Counter

c = Counter(digits)
print(c)

print(digits)
i = iter(digits)
ns = list(map(lambda ab: ab[0]*10+ab[1], zip(i, i)))
print (ns)

# gave a jumble of punctuation and spaces
#t = ''.join(map(chr, ns))
#print(t)

i = iter(ns)
triplets = list(zip(i, i, i))

print(sorted(Counter(a[0] for a in triplets).items()))
print(sorted(Counter(a[1] for a in triplets).items()))
print(sorted(Counter(a[2] for a in triplets).items()))

and the final prints are:

[(32, 1), (33, 308), (34, 540), (35, 452), (36, 774), (37, 316)]
[(30, 86), (31, 111), (32, 301), (33, 225), (34, 131), (35, 162), (36, 133),
(37, 286), (38, 161), (39, 283), (41, 185), (42, 46), (43, 129), (44, 70),
(45, 57), (46, 25)]
[(20, 2391)]

Andrew