hexathon

Common and uncommon hex string operations for python3
git clone git://git.defalsify.org/python-hexathon.git
Log | Files | Refs | LICENSE

commit 6324c58e428a60b8bd4619ee2a53dd8f94d1749d
parent 3656c05d71e548b0439971f52c5f7a5d494a0a23
Author: lash <dev@holbrook.no>
Date:   Mon, 14 Feb 2022 13:44:49 +0000

Fix compact bug on 0x prefix

Diffstat:
Mhexathon/parse.py | 2+-
Msetup.cfg | 4+---
Mtests/test_basic.py | 3+++
3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hexathon/parse.py b/hexathon/parse.py @@ -52,8 +52,8 @@ def add_0x(hx, allow_empty=False, compact_value=False): def compact(hx, allow_empty=False): - hx = strip_0x(hx, allow_empty) i = 0 + hx = strip_0x(hx) for i in range(len(hx)): if hx[i] != '0': break diff --git a/setup.cfg b/setup.cfg @@ -5,8 +5,6 @@ url=https://gitlab.com/nolash/python-hexathon author_email=dev@holbrook.no name=hexathon -version=0.1.1 +version=0.1.3 description=Common and uncommon hex string operations author=Louis Holbrook - - diff --git a/tests/test_basic.py b/tests/test_basic.py @@ -41,6 +41,9 @@ class HexTest(unittest.TestCase): def test_compact(self): self.assertEqual(hexathon.compact('000abc'), 'abc') + self.assertEqual(hexathon.compact('0x000abc'), 'abc') + self.assertEqual(hexathon.compact('abc'), 'abc') + self.assertEqual(hexathon.compact('0xabc'), 'abc') if __name__ == '__main__':