Browse Source

Output cosmetics

master
Non Boong 10 years ago
parent
commit
d1e0899a87
  1. 80
      darkened.py
  2. 20
      index.html

80
darkened.py

@ -5,6 +5,42 @@ import json
CHAR_REDACTED = '\u2588' # Full block. CHAR_REDACTED = '\u2588' # Full block.
CHAR_CONFLICT = '\u2573' # Box drawings light diagonal cross. CHAR_CONFLICT = '\u2573' # Box drawings light diagonal cross.
#------ begin prefab input
cipher1 = [
['lgPNUJU8', 'qLvBBQ==', '5GfdMat4', 'z8hPe4BlxxdUMXzi4w==', '2IheMA==',
'uZyB', 'wVCtnQ==', 'VnU=', '/pTNipiB55M=', 'XcT1gQ==', 'gxU8', '9MYX',
'io0='],
['0fOyC2/y', 'bg8=', 'bu2T', 'rJH6dWUzpg==', 'B4BTkvtl', '+Ug=', '6wky',
'H78=', 'nx8=', 'TO3/fbE=', 'tqw=', 'S4k8', '+mXOsQ==', 'E3rblIM=',
'bIu6qbrh1g=='],
['sfjl', 'JBxnLbfe0k0n', 'BShgq+QrmdquMA==', 'VYD1hx8=', 'MLk=', 'ig==',
'oasqOoWF', 'Asw=', 'Rof1s/gpQQONcnk=', 'ZW3zOSnTvyg=', 'QlA=',
'6Q0qOw=='],
['9fPa', '2mFZdDltLL4=', '13vdBg==', '+eWH', 'koB24LLGnxs=', 'CedkJ3k=',
'b41+QUU=', 'fRkV', '4/Yc', 'anY6cA==', 'muk=', '9LrH', '5t1uXU0=',
'M1eqTaWs'],
['8Ah2Pq4=', 'ouQ=', 'miJQVgwle6yOcg==', 'PPc=', '6jes', 'kYsY2ynZdg==']]
pad1 = [
['xWusIv5F', '29q4dg==', 'zAa7Rc4K', 'pqY7HvIXqHA1RRWMhA==', None, None,
'lSXD+g==', None, None, None, None, None, None],
['sJDRbhyB', None, None, None, None, 'uDs=', 'jWhA', None, '6Ho=',
'J4OQCp0=', '39g=', 'JuhF', 'kgS41A==', 'fR+t8fE=', None],
['5ZCA', None, None, None, 'Wco=', None, None, None, 'L+mR1ohML2foHA0=',
None, None, None],
['sbuL', 'qhM8EFAOWM0=', 'oxO8cg==', None, '/eYQidGv/nc=', 'epMLVQA=',
None, None, 'i5dv', 'Dh9fFA==', None, 'gNKi', 'lrEPMyg=', None],
[None, None, '+UoxOmBAFcvrFg==', 'Xo4=', None, '4f56t0C6WA==']]
pad2 = [
[None, None, None, None, 'nvo/RQ==', '7ebk', None, 'Pxs=',
'jvG/+ffvzr8=', 'KayU9Q==', '8H1Z', 'nKdz', '5OI='],
[None, 'GmA=', 'GoX2', '/OSQHAtXxw==', 'd+Ej94lL', None, None, 'fsw=',
None, None, None, None, None, None, 'AO7bwt+F+A=='],
[None, 'YXBKZdaztixJ', 'YEYD2Z1b7bPBXg==', 'NvKU5HQ=', None, '6w==',
'085ZT+nx', 'bao=', None, 'FwiAXEih3EA=', 'ICk=', 'r1l+FQ=='],
[None, None, None, 'jY3i', None, None, 'R/kWIDE=', 'O01B', None, None,
'84c=', None, 'kq8PNCM=', 'UCXLPs2F'],
['h2cYGdo=', 'wIE=', None, None, 'nl/J', None]]
#------ end prefab input
## [['an', 'msg', 'is', 'a', 'list', 'of', 'lines,'], ## [['an', 'msg', 'is', 'a', 'list', 'of', 'lines,'],
## ['where', 'each', 'line', 'is', 'a', 'list', 'of', 'words.']] ## ['where', 'each', 'line', 'is', 'a', 'list', 'of', 'words.']]
@ -102,54 +138,20 @@ followed by a second one"""
print('### Redacting prefab plaintext') print('### Redacting prefab plaintext')
redaction = redact(plaintext,2) redaction = redact(plaintext,2)
for pad in redaction['pads']: for pad in redaction['pads']:
print('# pOTP >>>') print('\n# pOTP >>>')
print(pad) print(pad)
print('# >>> Unredaction') print('# >>> Unredaction')
print(unredact(redaction['cipher'],pad)) print(unredact(redaction['cipher'],pad))
print('### >>> integration >>>') print('\n### >>> integration >>>')
print(unredact(redaction['cipher'],*redaction['pads'])) print(unredact(redaction['cipher'],*redaction['pads']))
print('### Simulating incoming [prefab] ciphertext and conflicting pads') print('\n\n### Simulating incoming [prefab] ciphertext and conflicting pads')
cipher1 = [
['lgPNUJU8', 'qLvBBQ==', '5GfdMat4', 'z8hPe4BlxxdUMXzi4w==', '2IheMA==',
'uZyB', 'wVCtnQ==', 'VnU=', '/pTNipiB55M=', 'XcT1gQ==', 'gxU8', '9MYX',
'io0='],
['0fOyC2/y', 'bg8=', 'bu2T', 'rJH6dWUzpg==', 'B4BTkvtl', '+Ug=', '6wky',
'H78=', 'nx8=', 'TO3/fbE=', 'tqw=', 'S4k8', '+mXOsQ==', 'E3rblIM=',
'bIu6qbrh1g=='],
['sfjl', 'JBxnLbfe0k0n', 'BShgq+QrmdquMA==', 'VYD1hx8=', 'MLk=', 'ig==',
'oasqOoWF', 'Asw=', 'Rof1s/gpQQONcnk=', 'ZW3zOSnTvyg=', 'QlA=',
'6Q0qOw=='],
['9fPa', '2mFZdDltLL4=', '13vdBg==', '+eWH', 'koB24LLGnxs=', 'CedkJ3k=',
'b41+QUU=', 'fRkV', '4/Yc', 'anY6cA==', 'muk=', '9LrH', '5t1uXU0=',
'M1eqTaWs'],
['8Ah2Pq4=', 'ouQ=', 'miJQVgwle6yOcg==', 'PPc=', '6jes', 'kYsY2ynZdg==']]
pad1 = [
['xWusIv5F', '29q4dg==', 'zAa7Rc4K', 'pqY7HvIXqHA1RRWMhA==', None, None,
'lSXD+g==', None, None, None, None, None, None],
['sJDRbhyB', None, None, None, None, 'uDs=', 'jWhA', None, '6Ho=',
'J4OQCp0=', '39g=', 'JuhF', 'kgS41A==', 'fR+t8fE=', None],
['5ZCA', None, None, None, 'Wco=', None, None, None, 'L+mR1ohML2foHA0=',
None, None, None],
['sbuL', 'qhM8EFAOWM0=', 'oxO8cg==', None, '/eYQidGv/nc=', 'epMLVQA=',
None, None, 'i5dv', 'Dh9fFA==', None, 'gNKi', 'lrEPMyg=', None],
[None, None, '+UoxOmBAFcvrFg==', 'Xo4=', None, '4f56t0C6WA==']]
pad2 = [
[None, None, None, None, 'nvo/RQ==', '7ebk', None, 'Pxs=',
'jvG/+ffvzr8=', 'KayU9Q==', '8H1Z', 'nKdz', '5OI='],
[None, 'GmA=', 'GoX2', '/OSQHAtXxw==', 'd+Ej94lL', None, None, 'fsw=',
None, None, None, None, None, None, 'AO7bwt+F+A=='],
[None, 'YXBKZdaztixJ', 'YEYD2Z1b7bPBXg==', 'NvKU5HQ=', None, '6w==',
'085ZT+nx', 'bao=', None, 'FwiAXEih3EA=', 'ICk=', 'r1l+FQ=='],
[None, None, None, 'jY3i', None, None, 'R/kWIDE=', 'O01B', None, None,
'84c=', None, 'kq8PNCM=', 'UCXLPs2F'],
['h2cYGdo=', 'wIE=', None, None, 'nl/J', None]]
for pad in [pad1,pad2]: for pad in [pad1,pad2]:
print('# pOTP >>>') print('\n# pOTP >>>')
#print(json.dumps(pad,indent=4)) #print(json.dumps(pad,indent=4))
print(pad) print(pad)
print('# >>> Unredaction') print('# >>> Unredaction')
print(unredact(cipher1,pad)) print(unredact(cipher1,pad))
print('### >>> integration >>>') print('\n### >>> integration >>>')
print(unredact(cipher1,pad1,pad2)) print(unredact(cipher1,pad1,pad2))
print('</pre></body></html>') print('</pre></body></html>')

20
index.html

@ -1,19 +1,25 @@
<!DOCTYPE html><html lang="en"><head><title>Testing DarkenedAges library</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body><pre> <!DOCTYPE html><html lang="en"><head><title>Testing DarkenedAges library</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body><pre>
### Redacting prefab plaintext ### Redacting prefab plaintext
# pOTP >>> # pOTP >>>
[['U7holQa1', None, None, 'Cm0oZSE='], ['bzjdOcq5B50=', 'zoc=', 'tw==', 'LKTx634Z', None]] [[None, None, None, None], [None, None, None, 'mD4Sa5hk', '2Sz0']]
# >>> Unredaction # >>> Unredaction
Here's ███ █████ line, ██████ ███ █████ █████
followed by a second ███ ████████ ██ █ second one
# pOTP >>> # pOTP >>>
[[None, 'xy2W', 'tW2dAiQ=', None], [None, None, None, None, '6jsh']] [['M83DT43U', 'sLdj', 'nhhdnNA=', 'KGaTVmY='], ['63UpKI/wdSE=', 'l1Q=', 'tg==', None, None]]
# >>> Unredaction # >>> Unredaction
██████ the first █████ Here's the first line,
████████ ██ █ ██████ one followed by a ██████ ███
### >>> integration >>> ### >>> integration >>>
Here's the first line, Here's the first line,
followed by a second one followed by a second one
### Simulating incoming [prefab] ciphertext and conflicting pads ### Simulating incoming [prefab] ciphertext and conflicting pads
# pOTP >>> # pOTP >>>
[['xWusIv5F', '29q4dg==', 'zAa7Rc4K', 'pqY7HvIXqHA1RRWMhA==', None, None, 'lSXD+g==', None, None, None, None, None, None], ['sJDRbhyB', None, None, None, None, 'uDs=', 'jWhA', None, '6Ho=', 'J4OQCp0=', '39g=', 'JuhF', 'kgS41A==', 'fR+t8fE=', None], ['5ZCA', None, None, None, 'Wco=', None, None, None, 'L+mR1ohML2foHA0=', None, None, None], ['sbuL', 'qhM8EFAOWM0=', 'oxO8cg==', None, '/eYQidGv/nc=', 'epMLVQA=', None, None, 'i5dv', 'Dh9fFA==', None, 'gNKi', 'lrEPMyg=', None], [None, None, '+UoxOmBAFcvrFg==', 'Xo4=', None, '4f56t0C6WA==']] [['xWusIv5F', '29q4dg==', 'zAa7Rc4K', 'pqY7HvIXqHA1RRWMhA==', None, None, 'lSXD+g==', None, None, None, None, None, None], ['sJDRbhyB', None, None, None, None, 'uDs=', 'jWhA', None, '6Ho=', 'J4OQCp0=', '39g=', 'JuhF', 'kgS41A==', 'fR+t8fE=', None], ['5ZCA', None, None, None, 'Wco=', None, None, None, 'L+mR1ohML2foHA0=', None, None, None], ['sbuL', 'qhM8EFAOWM0=', 'oxO8cg==', None, '/eYQidGv/nc=', 'epMLVQA=', None, None, 'i5dv', 'Dh9fFA==', None, 'gNKi', 'lrEPMyg=', None], [None, None, '+UoxOmBAFcvrFg==', 'Xo4=', None, '4f56t0C6WA==']]
# >>> Unredaction # >>> Unredaction
@ -22,6 +28,7 @@ access ██ ███ ███████ ██████ As far ██ w
The █████████ ██████████ █████ is █ ██████ ██ independent ████████ ██ ████ The █████████ ██████████ █████ is █ ██████ ██ independent ████████ ██ ████
DHQ predicts that ███ official story █████ ███ has died ██ the plane ██████ DHQ predicts that ███ official story █████ ███ has died ██ the plane ██████
█████ ██ challenged by ███ public. █████ ██ challenged by ███ public.
# pOTP >>> # pOTP >>>
[[None, None, None, None, 'nvo/RQ==', '7ebk', None, 'Pxs=', 'jvG/+ffvzr8=', 'KayU9Q==', '8H1Z', 'nKdz', '5OI='], [None, 'GmA=', 'GoX2', '/OSQHAtXxw==', 'd+Ej94lL', None, None, 'fsw=', None, None, None, None, None, None, 'AO7bwt+F+A=='], [None, 'YXBKZdaztixJ', 'YEYD2Z1b7bPBXg==', 'NvKU5HQ=', None, '6w==', '085ZT+nx', 'bao=', None, 'FwiAXEih3EA=', 'ICk=', 'r1l+FQ=='], [None, None, None, 'jY3i', None, None, 'R/kWIDE=', 'O01B', None, None, '84c=', None, 'kq8PNCM=', 'UCXLPs2F'], ['h2cYGdo=', 'wIE=', None, None, 'nl/J', None]] [[None, None, None, None, 'nvo/RQ==', '7ebk', None, 'Pxs=', 'jvG/+ffvzr8=', 'KayU9Q==', '8H1Z', 'nKdz', '5OI='], [None, 'GmA=', 'GoX2', '/OSQHAtXxw==', 'd+Ej94lL', None, None, 'fsw=', None, None, None, None, None, None, 'AO7bwt+F+A=='], [None, 'YXBKZdaztixJ', 'YEYD2Z1b7bPBXg==', 'NvKU5HQ=', None, '6w==', '085ZT+nx', 'bao=', None, 'FwiAXEih3EA=', 'ICk=', 'r1l+FQ=='], [None, None, None, 'jY3i', None, None, 'R/kWIDE=', 'O01B', None, None, '84c=', None, 'kq8PNCM=', 'UCXLPs2F'], ['h2cYGdo=', 'wIE=', None, None, 'nl/J', None]]
# >>> Unredaction # >>> Unredaction
@ -30,6 +37,7 @@ DHQ predicts that ███ official story █████ ███ has died
███ El-Hamdan encryption crack ██ a result of ███████████ research by FTT. ███ El-Hamdan encryption crack ██ a result of ███████████ research by FTT.
███ ████████ ████ the ████████ █████ (that FTT ███ ████ in ███ train crash) ███ ████████ ████ the ████████ █████ (that FTT ███ ████ in ███ train crash)
won't be ██████████ ██ the ███████ won't be ██████████ ██ the ███████
### >>> integration >>> ### >>> integration >>>
Sharky says (after interrogating Frau Tze Tung in person), that she had no Sharky says (after interrogating Frau Tze Tung in person), that she had no
access to the Pujinda paper. As far as we know, it may have never leaked. access to the Pujinda paper. As far as we know, it may have never leaked.

Loading…
Cancel
Save