|
| 1 | +# -*- coding: UTF-8 -*- |
| 2 | +"""Rick Astley Codec - Rick Astley's song content encoding. |
| 3 | +
|
| 4 | +This codec: |
| 5 | +- en/decodes strings from str to str |
| 6 | +- en/decodes strings from bytes to bytes |
| 7 | +- decodes file content to str (read) |
| 8 | +- encodes file content from str to bytes (write) |
| 9 | +""" |
| 10 | +from ..__common__ import * |
| 11 | + |
| 12 | + |
| 13 | +__examples__ = { |
| 14 | + 'enc(rick|rick-astley)': {'this is a test': "TELL LET You gonna + You gonna + NEVER + TELL UP gonna TELL"}, |
| 15 | +} |
| 16 | + |
| 17 | + |
| 18 | +# inspired from: https://github.com/moongazer07/rick-cipher |
| 19 | +ENCMAP = { |
| 20 | + 'A': "NEVER", 'B': "GONNA", 'C': "GIVE", 'D': "YOU", 'E': "UP", 'F': "Never", 'G': "Gonna", 'H': "LET", 'I': "You", |
| 21 | + 'J': "DOWN", 'K': "NEver", 'L': "GOnna", 'M': "TURN", 'N': "AROUND", 'O': "AND", 'P': ["DESERT", "DESSERT"], |
| 22 | + 'Q': "YOu", 'R': "NEVer", 'S': "gonna", 'T': "TELL", 'U': "A", 'V': "LIE", 'W': "and", 'X': "HURT", 'Y': "you", |
| 23 | + 'Z': "rick astley", ' ': "+", '.': ".", '\n': "\n", |
| 24 | + '0': "0", '1': "1", '2': "2", '3': "3", '4': "4", '5': "5", '6': "6", '7': "7", '8': "8", '9': "9", |
| 25 | +} |
| 26 | + |
| 27 | + |
| 28 | +add_map("rick", ENCMAP, "?", " ", ignore_case="encode", pattern=r"^rick(?:[-_]astley)?(?:[-_]cipher)?$", |
| 29 | + printables_rate=1.) |
| 30 | + |
0 commit comments