# -*- coding: utf8 -*- import binascii pdu = ("@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞ\x1bÆæßÉ !\"#¤%&'()*+,-./0123456789:;<=>?" "¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà") ext = ("````````````````````^```````````````````{}`````\\````````````[~]`" "|````````````````````````````````````€``````````````````````````") def pdu_encode(m): res = "" for i in m: idx = pdu.find(i); if idx != -1: res += chr(idx) continue idx = ext.find(i) if idx != -1: res += chr(27) + chr(idx) return binascii.b2a_hex(res.encode('utf-8')) print(pdu_encode("Cryptomasses on groove"))
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)