Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
neoppod
Commits
cbb992b2
Commit
cbb992b2
authored
Oct 26, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neo.lib.util: bin & dump roughly do the same thing as a2b_hex & b2a_hex from binascii
parent
f4220e19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
neo/lib/util.py
neo/lib/util.py
+6
-16
No files found.
neo/lib/util.py
View file @
cbb992b2
...
...
@@ -18,6 +18,7 @@
import
re
import
socket
from
binascii
import
a2b_hex
,
b2a_hex
from
hashlib
import
sha1
from
Queue
import
deque
from
struct
import
pack
,
unpack
...
...
@@ -39,26 +40,15 @@ def add64(packed, offset):
def
dump
(
s
):
"""Dump a binary string in hex."""
if
s
is
None
:
return
None
if
isinstance
(
s
,
str
):
ret
=
[]
for
c
in
s
:
ret
.
append
(
'%02x'
%
ord
(
c
))
return
''
.
join
(
ret
)
else
:
if
s
is
not
None
:
if
isinstance
(
s
,
str
):
return
b2a_hex
(
s
)
return
repr
(
s
)
def
bin
(
s
):
"""Inverse of dump method."""
if
s
is
None
:
return
None
ret
=
[]
while
len
(
s
):
ret
.
append
(
chr
(
int
(
s
[:
2
],
16
)))
s
=
s
[
2
:]
return
''
.
join
(
ret
)
if
s
is
not
None
:
return
a2b_hex
(
s
)
def
makeChecksum
(
s
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment