Skip to content

Instantly share code, notes, and snippets.

@astraw38
Created May 12, 2015 13:42
Show Gist options
  • Save astraw38/0c4295a936be3a86f386 to your computer and use it in GitHub Desktop.
Save astraw38/0c4295a936be3a86f386 to your computer and use it in GitHub Desktop.
to byte array!
Dec: 65537
Bin: 10000000000000001
Str_val: 000000010000000000000001
Converted: ['00000001', '00000000', '00000001']
Byte Array: <__main__.c_ubyte_Array_3 object at 0x01E4F9E0>
Raw: [1, 0, 1]
Bin: ['1', '0', '1']
Dec: 12345678900987654321
Bin: 1010101101010100101010011000110011011100011001110111000010110001
Str_val: 1010101101010100101010011000110011011100011001110111000010110001
Converted: ['10101011', '01010100', '10101001', '10001100', '11011100', '01100111', '01110000', '10110001']
Byte Array: <__main__.c_ubyte_Array_8 object at 0x01E4FB70>
Raw: [171, 84, 169, 140, 220, 103, 112, 177]
Bin: ['10101011', '1010100', '10101001', '10001100', '11011100', '1100111', '1110000', '10110001']
Dec: 1233
Bin: 10011010001
Str_val: 0000010011010001
Converted: ['00000100', '11010001']
Byte Array: <__main__.c_ubyte_Array_2 object at 0x01E4F9E0>
Raw: [4, 209]
Bin: ['100', '11010001']
Dec: 1
Bin: 1
Str_val: 00000001
Converted: ['00000001']
Byte Array: <__main__.c_ubyte_Array_1 object at 0x01E4FB70>
Raw: [1]
Bin: ['1']
Dec: 6553455
Bin: 11000111111111101101111
Str_val: 011000111111111101101111
Converted: ['01100011', '11111111', '01101111']
Byte Array: <__main__.c_ubyte_Array_3 object at 0x01E4F9E0>
Raw: [99, 255, 111]
Bin: ['1100011', '11111111', '1101111']
Dec: 500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Bin: 10111000101010001101100110111011111000010010001111110000000101111011100000001011000000000100011101000100010111010100000110000100110000101100001000110000111111001101100111001011000101001000011101001110101101001011011010100001110011110001000100110101110111111101001011011110100011101010001101100000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Str_val: 000010111000101010001101100110111011111000010010001111110000000101111011100000001011000000000100011101000100010111010100000110000100110000101100001000110000111111001101100111001011000101001000011101001110101101001011011010100001110011110001000100110101110111111101001011011110100011101010001101100000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Converted: ['00001011', '10001010', '10001101', '10011011', '10111110', '00010010', '00111111', '00000001', '01111011', '10000000', '10110000', '00000100', '01110100', '01000101', '11010100', '00011000', '01001100', '00101100', '00100011', '00001111', '11001101', '10011100', '10110001', '01001000', '01110100', '11101011', '01001011', '01101010', '00011100', '11110001', '00010011', '01011101', '11111101', '00101101', '11101000', '11101010', '00110110', '00000101', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000', '00000000']
Byte Array: <__main__.c_ubyte_Array_54 object at 0x01E4FB70>
Raw: [11, 138, 141, 155, 190, 18, 63, 1, 123, 128, 176, 4, 116, 69, 212, 24, 76, 44, 35, 15, 205, 156, 177, 72, 116, 235, 75, 106, 28, 241, 19, 93, 253, 45, 232, 234, 54, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Bin: ['1011', '10001010', '10001101', '10011011', '10111110', '10010', '111111', '1', '1111011', '10000000', '10110000', '100', '1110100', '1000101', '11010100', '11000', '1001100', '101100', '100011', '1111', '11001101', '10011100', '10110001', '1001000', '1110100', '11101011', '1001011', '1101010', '11100', '11110001', '10011', '1011101', '11111101', '101101', '11101000', '11101010', '110110', '101', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
[Finished in 0.1s]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment