Skip to content

binascii: Add required argument to <int>.to_bytes(...) call.#203

Closed
ccooper21 wants to merge 1 commit intomicropython:masterfrom
ccooper21:binascii-a2b_base64-fix
Closed

binascii: Add required argument to <int>.to_bytes(...) call.#203
ccooper21 wants to merge 1 commit intomicropython:masterfrom
ccooper21:binascii-a2b_base64-fix

Conversation

@ccooper21
Copy link
Copy Markdown
Contributor

@ccooper21 ccooper21 commented Aug 12, 2017

The a2b_base64(...) function in the binascii module was failing due to an invalid call being made to the <int>.to_bytes(...) function. The <int>.to_bytes(...) function requires two arguments. The first specifies the number of bytes to return, and the second specifies the endianness of those bytes. By definition, Base64 encoding is big endian.

This change also fixed the test cases for the base64 module.

@ccooper21 ccooper21 changed the title binascii: Add required argument to call to <int>.to_bytes(...). binascii: Add required argument to <int>.to_bytes(...) call. Aug 13, 2017
@ccooper21 ccooper21 force-pushed the binascii-a2b_base64-fix branch 2 times, most recently from 418c445 to ebf07f1 Compare August 13, 2017 06:17
The <int>.to_bytes(...) function requires two arguments.  The first
specifies the number of bytes to return, and the second specifies the
endianness of those bytes.  By definition, Base64 encoding is big
endian.
@ccooper21 ccooper21 force-pushed the binascii-a2b_base64-fix branch from ebf07f1 to 19a5511 Compare August 13, 2017 15:56
@pfalcon
Copy link
Copy Markdown
Contributor

pfalcon commented Aug 15, 2017

Merged, thanks. Also added testcase which exposed the issue.

@ccooper21 ccooper21 deleted the binascii-a2b_base64-fix branch August 18, 2017 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants