MHuiG

「看庭前花开花落,望天上云卷云舒」

BinaryConversion

# Python BinaryConversion

Binary.py

    #coding:utf-8
    import re
    import argparse

    def bintostr(text):
        text = text.replace(' ','')
        text = re.findall(r'.{8}',text)
        s = map(lambda x:chr(int(x,2)),text) #批量二进制转十进制
        flag = ''.join(s)
        return (flag)

    def asciitostr(text):
        if ' ' in text:
            text = text.split(' ')
        elif ',' in text:
            text = text.split(',')
        s = map(lambda x:chr(int(x)),text)
        flag = ''.join(s)
        return flag

    def hextostr(text):
        text = re.findall(r'.{2}',text)
        #print text
        s = map(lambda x:chr(int(x,16)),text)
        #print s
        flag = ''.join(s)
        return flag

    if __name__ == '__main__':
        parser = argparse.ArgumentParser()
        parser.add_argument("-b")
        parser.add_argument("-a")
        parser.add_argument("-x")
        argv = parser.parse_args()
        #print argv
        if argv.b:
            res = bintostr(argv.b)
            print (res)
        elif argv.a:
            res = asciitostr(argv.a)
            print (res)
        elif argv.x:
            res = hextostr(argv.x)
            print (res)

Python Base

Base Python Base Base.pyimport base64def base64codes(): s = input() b64encode = base64...

Python Caesar

Caesar Python Caesar Caesar.py#-*-coding:utf-8-*-import osdef encryption(): str_raw = in...

推荐阅读
Python ASCII 字符串 转换 Python Baconian Python RailFenceCipher Cryptography Python Base 回顾几个有趣的小题目

留言区

Notes
Cryptography
Are You A Robot?