对输入字符串进行XOR加密

Write a python function that makes an XOR encryption of an input string. It is made of two sub-functions: MakeBitstream( string) takes a character string, converts each character into its Ascii binary value, and outputs the entire bitstream; Encrypt( message, key) takes a message string and a 2-character password, converts each of these into bitstreams; it than applies a bit-by-bit XOR function to each subsequent pair of characters from the message and the key, and outputs the resulting bit-stream. If the message has an odd number of characters, use the NULL character (Ascii: 00000000) to make it 2-bytes long.
编写一个对输入字符串进行XOR加密。它由两个子函数组成:MakeBitstream(字符串)采用一个字符串字符串,将每个字符转换为其Ascii二进制值,并输出整个位流;加密(消息,键)接受一个消息字符串和一个2字符的密码,将每个字符转换为位流;它将对消息和键的每一对字符应用逐位XOR函数,并输出生成的位流。如果消息的字符数为奇数,请使用NULL字符(Ascii:000000000)使其长2字节。

参考