Skip to content

Conversation

@csyhuang
Copy link

@csyhuang csyhuang commented Oct 5, 2020

Created a @staticmethod in the PrivateKey class called generate that creates a PrivateKey, which is a random hexadecimal string with nbytes bytes, using python's secrets standard module. A corresponding unit test is added.

Please let me know if the pull request meets the requirement, or there are any suggested changes.

Thank you!

#31

Returns:
A random hexadecimal string of length 2 * nbytes.
"""
return secrets.token_hex(nbytes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are supposed to return a PrivateKey object here, this will just return a random hexadecimal string.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SimoneBronzini , thanks for the reminder. I've made a correction there such that it returns a PrivateKey object, and I fix the random hexadecimal string to be of 32 bytes (for simplicity). Please let me know if that works or not? Thanks!

@csyhuang
Copy link
Author

Hi @SimoneBronzini I have made the change you mentioned and pushed the commit. May you have a look and let me know if that's OK? Thanks!

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