Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 5.1.0 (under development)

* Ignored HMAC character capitalization
([#93](https://github.com/laterpay/laterpay-client-python/issues/93))

## 5.0.0

* Removed the following long deprecated methods from the
Expand Down
1 change: 1 addition & 0 deletions laterpay/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def time_independent_HMAC_compare(a, b):
if len(a) != len(b):
return False
result = 0
a, b = a.lower(), b.lower()
for x, y in zip(a, b):
result |= ord(x) ^ ord(y)
return result == 0
Expand Down
6 changes: 4 additions & 2 deletions tests/test_signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ def test_verify_byte_signature(self):

secret = 'secret'

# Use some upper case characters to test for issue #93
verified = signing.verify(
b'346f3d53ad762f3ed3fb7f2427dec2bbfaf0338bb7f91f0460aff15c',
b'346f3d53ad762f3ed3fb7f2427deC2BBFAF0338BB7F91F0460AFF15C',
secret,
params,
url,
Expand All @@ -153,8 +154,9 @@ def test_verify_unicode_signature(self):
'param2': ['value2', 'value3'],
}
url = u'https://endpoint.com/api'
# Use some upper case characters to test for issue #93
verified = signing.verify(
u'346f3d53ad762f3ed3fb7f2427dec2bbfaf0338bb7f91f0460aff15c',
u'346F3D53AD762F3ED3FB7F2427DEc2bbfaf0338bb7f91f0460aff15c',
u'secret',
params,
url,
Expand Down