[issue14322] More test coverage for hmac

2021-06-17 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2021-06-10 Thread Arjun


Arjun  added the comment:

would the update invalid test belong in the TestVectorsTestCase class or should 
I make a new one?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2021-06-09 Thread Arjun


Change by Arjun :


--
pull_requests: +25222
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/26636

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2021-06-09 Thread Arjun


Arjun  added the comment:

The only things I think we should add to the current hmac tests are 
test_update_error_handling and test_with_invalid_msg. 

For test_withnoncallable_digestmod(), hmac itself seems it can no longer be 
used:

>>> hmac.HMAC(b"", None, "hmac")

using new
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/arjun/Python/Sources/cpython/Lib/hmac.py", line 61, in __init__
self._init_hmac(key, msg, digestmod)
  File "/Users/arjun/Python/Sources/cpython/Lib/hmac.py", line 69, in _init_hmac
self._hmac = _hashopenssl.hmac_new(key, msg, digestmod=digestmod)
ValueError: unsupported hash type hmac

For tests test_small_block_size and test_no_block_size, a custom .blocksize 
cannot be set (changing .block_size has no difference on digest()):

>>> hmac.HMAC(b"", None, "md5").blocksize = 15

using new
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'HMAC' object attribute 'blocksize' is read-only

```
class myHMAC(hmac.HMAC):
blocksize = 1
def __init__(self, key, msg, digestmod_):
super().__init__(key, msg, digestmod=digestmod_)

h = myHMAC(b"key", b"", digestmod_="md5")
h.digest() # <- works perfectly fine.
```
Does this sound okay? I can go ahead an implement it if so.

--
nosy: +CCLDArjun -Vijay.Majagaonkar, christian.heimes, eric.araujo, 
gregory.p.smith, packetslave, pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2021-04-17 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2020-10-22 Thread Irit Katriel


Irit Katriel  added the comment:

The patch is out of date and needs to be refreshed.

--
components: +Library (Lib)
nosy: +iritkatriel
stage: patch review -> needs patch
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 
3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2019-03-15 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2014-06-30 Thread Mark Lawrence

Mark Lawrence added the comment:

If there isn't a signed contributor agreement I'll put up a new version of the 
patch.

In msg156758 Antoine said 'don't use except: self.fail(), just let the 
exception pass through'.  There are several of these in the existing code.  
Should they all be removed or must it be done on a case by case basis?

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14322
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2012-10-06 Thread Christian Heimes

Christian Heimes added the comment:

IIRC we also need a signed contributor agreement in order to commit your patch.

--
nosy: +christian.heimes
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2012-03-28 Thread Vijay Majagaonkar

Changes by Vijay Majagaonkar vijay.majagaon...@gmail.com:


--
nosy: +Vijay.Majagaonkar

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2012-03-25 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Some style comments:

- don't use except: self.fail(), just let the exception pass through

- when monkeypatching hmac.new, use a try...finally block so that the mock 
doesn't stay in place if the test fails for whatever reason

- it's a bit of a nit, but when using with warnings.catch_warnings, I would 
put the asserts on the context manager result outside of the with block

- I get a warning in test_noncallable_digestmod, it would be nice to silence it:

/home/antoine/cpython/default/Lib/test/test_hmac.py:254: RuntimeWarning: No 
block_size attribute on given digest object; Assuming 64.
  h = hmac.HMAC(bkey, b, hmac)

--
nosy: +gregory.p.smith, pitrou
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2012-03-16 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for the patch.  Could you rewrite it using self.assert* methods instead 
of asserts?

I’m not an hmac expert, so you may have to wait a bit for another core 
developer to see and commit the patch.

--
nosy: +eric.araujo
title: More test coverage for hmac.py - More test coverage for hmac

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14322] More test coverage for hmac

2012-03-16 Thread Brian Landers

Brian Landers br...@packetslave.com added the comment:

Updated to use the correct assert* methods.

--
Added file: http://bugs.python.org/file24896/test_hmac.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com