Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- code = [0x08,0x3e,0x10,0xea,0x49,0xcc,0x21,0xb5,0xd2,0x11,0x91,0xcf,0x0e,0x01,0xcd,0x96,0xd5,0x3e,0x05,0x12,0xea,0x95,0xcf,0xea,0x63,0xd1,0xcd,0x27,0x39,0x54,0x01,0x04,0x4f,0xcd,0x95,0xd5,0x23,0x01,0x02,0x62,0xcd,0x95,0xd5,0x01,0x02,0x53,0xcd,0x95,0xd5,0x2e,0xec,0x0e,0x03,0xcd,0x96,0xd5,0x1e,0xd6,0x2e,0xec,0xcd,0x29,0x38,0x1e,0xe1,0x2e,0xaa,0xcd,0x29,0x38,0xaf,0xea,0x80,0xda,0xcd,0x68,0x3a,0x30,0xfc,0x06,0x1c,0x21,0x48,0x78,0xc3,0xd6,0x35,0x58,0x2a,0x87,0x86,0x23,0x12,0x13,0x0d,0x20,0xf7,0xc9]
- char_conversion = [
- (0x7f, " "),
- (0x80, "A"),
- (0x81, "B"),
- (0x82, "C"),
- (0x83, "D"),
- (0x84, "E"),
- (0x85, "F"),
- (0x86, "G"),
- (0x87, "H"),
- (0x88, "I"),
- (0x89, "J"),
- (0x8a, "K"),
- (0x8b, "L"),
- (0x8c, "M"),
- (0x8d, "N"),
- (0x8e, "O"),
- (0x8f, "P"),
- (0x90, "Q"),
- (0x91, "R"),
- (0x92, "S"),
- (0x93, "T"),
- (0x94, "U"),
- (0x95, "V"),
- (0x96, "W"),
- (0x97, "X"),
- (0x98, "Y"),
- (0x99, "Z"),
- (0x9a, "("),
- (0x9b, ")"),
- (0x9c, ":"),
- (0x9d, ";"),
- (0x9e, "["),
- (0x9f, "]"),
- (0xa0, "a"),
- (0xa1, "b"),
- (0xa2, "c"),
- (0xa3, "d"),
- (0xa4, "e"),
- (0xa5, "f"),
- (0xa6, "g"),
- (0xa7, "h"),
- (0xa8, "i"),
- (0xa9, "j"),
- (0xaa, "k"),
- (0xab, "l"),
- (0xac, "m"),
- (0xad, "n"),
- (0xae, "o"),
- (0xaf, "p"),
- (0xb0, "q"),
- (0xb1, "r"),
- (0xb2, "s"),
- (0xb3, "t"),
- (0xb4, "u"),
- (0xb5, "v"),
- (0xb6, "w"),
- (0xb7, "x"),
- (0xb8, "y"),
- (0xb9, "z"),
- (0xe1, "[pk]"),
- (0xe2, "[mn]"),
- (0xe3, "-"),
- (0xe6, "?"),
- (0xe7, "!"),
- (0xef, "♂"),
- (0xf1, "×"),
- (0xf2, "."),
- (0xf3, "/"),
- (0xf4, ","),
- (0xf5, "♀"),
- ]
- char_conversion_dict = dict(char_conversion)
- def hex_to_twochar(num, lastchar):
- twochar = None
- for char in char_conversion:
- doubled_char = (char[0] * 2) & 0xff
- required_num = ((num - doubled_char) & 0xff)
- if required_num in char_conversion_dict:
- twochar = [char[1],char_conversion_dict[required_num]]
- if char[1] == lastchar:
- return twochar
- return twochar
- lastchar = "A"
- output = ""
- for i, byte in enumerate(code):
- twochar = hex_to_twochar(byte, lastchar)
- lastchar = twochar[1]
- output += twochar[0] + twochar[1]
- if i % 5 == 4:
- output += "\n"
- lastchar = "A"
- if i % 30 == 29:
- output += "===\n"
- print output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement