Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make digest_size a class variable #70887

Closed
rhettinger opened this issue Apr 6, 2016 · 5 comments
Closed

Make digest_size a class variable #70887

rhettinger opened this issue Apr 6, 2016 · 5 comments
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@rhettinger
Copy link
Contributor

BPO 26700
Nosy @rhettinger, @gpshead, @tiran

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2017-05-06.22:50:43.158>
created_at = <Date 2016-04-06.07:59:10.344>
labels = ['extension-modules', 'type-feature']
title = 'Make digest_size a class variable'
updated_at = <Date 2017-05-06.22:50:43.156>
user = 'https://github.com/rhettinger'

bugs.python.org fields:

activity = <Date 2017-05-06.22:50:43.156>
actor = 'gregory.p.smith'
assignee = 'none'
closed = True
closed_date = <Date 2017-05-06.22:50:43.158>
closer = 'gregory.p.smith'
components = ['Extension Modules']
creation = <Date 2016-04-06.07:59:10.344>
creator = 'rhettinger'
dependencies = []
files = []
hgrepos = []
issue_num = 26700
keywords = []
message_count = 5.0
messages = ['262940', '266761', '266762', '275441', '293175']
nosy_count = 3.0
nosy_names = ['rhettinger', 'gregory.p.smith', 'christian.heimes']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue26700'
versions = ['Python 3.6']

@rhettinger
Copy link
Contributor Author

It would be nicer if this worked:

     >>> hashlib.md5.digest_size
     64

@rhettinger rhettinger added extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Apr 6, 2016
@gpshead
Copy link
Member

gpshead commented May 31, 2016

+cc Christian Heimes: do the upcoming standard hash functions amenable to a constant class attribute digest_size?

Are any of the expected future hashes variable length from a single class / constructor function?

@tiran
Copy link
Member

tiran commented May 31, 2016

Not all hash functions have a fixed digest size, e.g. blake2 is a variable length hash algorithm. https://pythonhosted.org/pyblake2/examples.html#using-different-digest-sizes How about a new class attribute default_digest_size?

@gpshead
Copy link
Member

gpshead commented Sep 9, 2016

I agree that adding a .default_digest_size attribute to the constructors in the hashlib module would be good... the challenge is in actually doing it. Today they are not classes, they are built-in functions that come from one of two possible extension modules. Adding properties to a built-in function is a challenge (I don't think that is even possible in the C API, PyMethodDef doesn't support that).

We could hack around it, wrap them in classes, etc. But they have never been classes and there is little good reason for them to be a type.

@gpshead
Copy link
Member

gpshead commented May 6, 2017

I'm rejecting this one as low value / infeasible.

@gpshead gpshead closed this as completed May 6, 2017
@gpshead gpshead removed their assignment May 6, 2017
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants