Python Cryptography Tools: Difference between revisions
Jump to navigation
Jump to search
Created page with "== Encoding == Integers can be '''encoded''' as either binary, decimal, hexadecimal, or Base64 (among others). <pre> >>> bin(95616) '0b10111010110000000' >>> hex(95616) '0x17580' >>> import base64 >>> base64.b64encode(95616) ... TypeError: a bytes-like object is required, not 'int' </pre>" |
|||
Line 8: | Line 8: | ||
>>> import base64 | >>> import base64 | ||
>>> base64.b64encode(95616) | >>> base64.b64encode(95616) | ||
TypeError: a bytes-like object is required, not 'int' | TypeError: a bytes-like object is required, not 'int' | ||
</pre> | </pre> |
Revision as of 23:18, 8 February 2024
Encoding
Integers can be encoded as either binary, decimal, hexadecimal, or Base64 (among others).
>>> bin(95616) '0b10111010110000000' >>> hex(95616) '0x17580' >>> import base64 >>> base64.b64encode(95616) TypeError: a bytes-like object is required, not 'int'