Refactoring crypto base changes #1806

Merged
g1itch merged 14 commits from crypto-sort into v0.6 2021-08-17 15:07:33 +02:00
g1itch commented 2021-08-13 18:09:23 +02:00 (Migrated from github.com)

Hello!

This is a meaningful subset of the changes in my branches compatibility, crypto, flake8*. Starting the refactoring from separation of protocol tests, crypto tests and the pyelliptic tests (added more).

Hello! This is a meaningful subset of the changes in my branches `compatibility`, `crypto`, `flake8*`. Starting the refactoring from separation of protocol tests, crypto tests and the pyelliptic tests (added more).
PeterSurda (Migrated from github.com) requested changes 2021-08-16 10:55:07 +02:00
PeterSurda (Migrated from github.com) left a comment

Please make the changes and review comments.

Please make the changes and review comments.
PeterSurda (Migrated from github.com) commented 2021-08-16 10:28:55 +02:00

I tested it, and the comparison between int and bytes doesn't work, at least in python2. It should probably be

if host[0] == 0xfe and host[1] & 0xc0 == 0x80:
I tested it, and the comparison between `int` and `bytes` doesn't work, at least in python2. It should probably be ``` if host[0] == 0xfe and host[1] & 0xc0 == 0x80: ```
PeterSurda (Migrated from github.com) commented 2021-08-16 10:50:35 +02:00

I think this test is missing in the new code.

I think this test is missing in the new code.
PeterSurda (Migrated from github.com) commented 2021-08-16 10:53:41 +02:00

perhaps

test_ip,
perhaps ``` test_ip, ```
PeterSurda (Migrated from github.com) commented 2021-08-16 10:54:40 +02:00

perhaps also

test_ip,
perhaps also ``` test_ip, ```
g1itch (Migrated from github.com) reviewed 2021-08-16 15:44:27 +02:00
g1itch (Migrated from github.com) commented 2021-08-16 15:44:27 +02:00

Oh, I see host[1]. In py2 it will be bytes. Perhaps I missed some sample in the test_checkIPv4Address()

~~Oh, I see `host[1]`. In py2 it will be bytes. Perhaps I missed some sample in the `test_checkIPv4Address()`~~
g1itch (Migrated from github.com) reviewed 2021-08-16 15:52:13 +02:00
g1itch (Migrated from github.com) commented 2021-08-16 15:52:13 +02:00

This part looks like TestCrypto.test_hash_string() above. The rest part is in TestAddresses .test_decode() and test_encode().

This part looks like `TestCrypto.test_hash_string()` above. The rest part is in `TestAddresses` `.test_decode()` and `test_encode()`.
g1itch (Migrated from github.com) reviewed 2021-08-16 16:03:45 +02:00
g1itch (Migrated from github.com) commented 2021-08-16 16:03:44 +02:00

yes, in py2 host[0] will be int

yes, in py2 `host[0]` will be int
g1itch (Migrated from github.com) reviewed 2021-08-16 16:37:32 +02:00
g1itch (Migrated from github.com) commented 2021-08-16 16:37:32 +02:00

OK, why don't just write if host[:2] == b'\xFE\x80' and what about IPv4 254.128.0.0?

~~OK, why don't just write `if host[:2] == b'\xFE\x80'` and~~ what about IPv4 254.128.0.0?
g1itch (Migrated from github.com) reviewed 2021-08-16 16:48:21 +02:00
g1itch (Migrated from github.com) commented 2021-08-16 16:48:21 +02:00

And also 169.254.0.0/16

And also 169.254.0.0/16
g1itch (Migrated from github.com) reviewed 2021-08-16 17:36:11 +02:00
g1itch (Migrated from github.com) commented 2021-08-16 17:36:11 +02:00

Also test_checkIPv6Address() should probably fail because the first sample is reserved for documentation:

https://www.ripe.net/participate/member-support/lir-basics/ipv6_reference_card.pdf

Also `test_checkIPv6Address()` should probably fail because the first sample is reserved for documentation: https://www.ripe.net/participate/member-support/lir-basics/ipv6_reference_card.pdf
PeterSurda (Migrated from github.com) reviewed 2021-08-17 10:22:58 +02:00
PeterSurda (Migrated from github.com) commented 2021-08-17 10:22:58 +02:00

Ok I missed that, looks ok.

Ok I missed that, looks ok.
PeterSurda (Migrated from github.com) approved these changes 2021-08-17 10:25:51 +02:00
This repo is archived. You cannot comment on pull requests.
No description provided.