Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
0xflotus committed Jan 11, 2023
1 parent 93fb248 commit c931992
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion rfc1924/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.2.4"
__version__ = "0.3.0"
__author__ = "0xflotus"

from .rfc1924 import encode, decode, savings
Expand Down
21 changes: 13 additions & 8 deletions rfc1924/rfc1924.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,19 @@


def encode(ipv6):
lst = [0] * 0o24
num_ipv6 = int(IPv6Address(ipv6))
idx = 0
while num_ipv6 > 0:
lst[idx] = num_ipv6 % 0x55
num_ipv6 //= 0x55
idx += 1
return "".join(map(lambda x: lookup_table[x], reversed(lst)))
return "".join(
map(
lambda chr: lookup_table[chr],
reversed(
list(
map(
lambda cnt: int(IPv6Address(ipv6)) // 0x55 ** cnt % 0x55,
range(0o24),
)
)
),
)
)


def decode(encoded_ipv6):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="rfc1924",
version="0.2.4",
version="0.3.0",
description="Implementation of RFC 1924",
long_description=README,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit c931992

Please sign in to comment.