Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
shrapnel
Commits
4c483bd0
Commit
4c483bd0
authored
Jul 23, 2014
by
Mark Peek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8
parent
abc4ee92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
test/test_asn1_python.py
test/test_asn1_python.py
+14
-12
test/test_ecdsa.py
test/test_ecdsa.py
+2
-2
No files found.
test/test_asn1_python.py
View file @
4c483bd0
...
...
@@ -16,16 +16,18 @@ class Test (unittest.TestCase):
def
test_list
(
self
):
R
=
self
.
round_trip
self
.
assertEquals
(
encode
([
0
,
1
,
2
]),
b'0
\
t
\
x02
\
x01
\
x00
\
x02
\
x01
\
x01
\
x02
\
x01
\
x02
'
)
R
([
0
,
1
,
2
],
([
0
,
1
,
2
],
11
))
R
([
0
,
1
,
2
],
([
0
,
1
,
2
],
11
))
self
.
assertEquals
(
encode
([
0
,
1
,[
2
,
3
,
4
]]),
b'0
\
x11
\
x02
\
x01
\
x00
\
x02
\
x01
\
x01
0
\
t
\
x02
\
x01
\
x02
\
x02
\
x01
\
x03
\
x02
\
x01
\
x04
'
)
R
([
0
,
1
,[
2
,
3
,
4
]],
([
0
,
1
,[
2
,
3
,
4
]],
19
))
self
.
assertEquals
(
encode
([
0
,
1
,
2
]),
b'0
\
t
\
x02
\
x01
\
x00
\
x02
\
x01
\
x01
\
x02
\
x01
\
x02
'
)
R
([
0
,
1
,
2
],
([
0
,
1
,
2
],
11
))
R
([
0
,
1
,
2
],
([
0
,
1
,
2
],
11
))
self
.
assertEquals
(
encode
([
0
,
1
,
[
2
,
3
,
4
]]),
b'0
\
x11
\
x02
\
x01
\
x00
\
x02
\
x01
\
x01
0
\
t
\
x02
\
x01
\
x02
\
x02
\
x01
\
x03
\
x02
\
x01
\
x04
'
)
R
([
0
,
1
,
[
2
,
3
,
4
]],
([
0
,
1
,
[
2
,
3
,
4
]],
19
))
def
test_longs
(
self
):
R
=
self
.
round_trip
R
(
1
<<
128
,
(
1
<<
128
,
19
))
R
(
-
1
<<
128
,
(
-
1
<<
128
,
19
))
R
(
1
<<
128
,
(
1
<<
128
,
19
))
R
(
-
1
<<
128
,
(
-
1
<<
128
,
19
))
n
=
92635422811926300371494754185131031660572678207193169844405659339331266122107L
R
(
n
,
(
n
,
35
))
nn
=
-
92635422811926300371494754185131031660572678207193169844405659339331266122107L
...
...
@@ -38,17 +40,17 @@ class Test (unittest.TestCase):
def
test_tuple
(
self
):
R
=
self
.
round_trip
R
((
0
,
1
,
2
),
((
0
,
1
,
2
),
11
))
R
((
0
,
1
,
2
),
((
0
,
1
,
2
),
11
))
R
((),
((),
2
))
def
test_dict
(
self
):
R
=
self
.
round_trip
R
({
1
:
2
,
3
:
"hi"
},
({
1
:
2
,
3
:
'hi'
},
19
))
R
({
1
:
2
,
3
:
"hi"
},
({
1
:
2
,
3
:
'hi'
},
19
))
def
test_set
(
self
):
R
=
self
.
round_trip
R
(
set
([
0
,
1
,
2
]),
(
set
([
0
,
1
,
2
]),
11
))
R
(
set
([(
0
,
1
),
2
]),
(
set
([(
0
,
1
),
2
]),
13
))
R
(
set
([
0
,
1
,
2
]),
(
set
([
0
,
1
,
2
]),
11
))
R
(
set
([(
0
,
1
),
2
]),
(
set
([(
0
,
1
),
2
]),
13
))
def
test_none
(
self
):
R
=
self
.
round_trip
...
...
@@ -60,7 +62,7 @@ class Test (unittest.TestCase):
def
test_complex_object
(
self
):
R
=
self
.
round_trip
x
=
[
12
,
"thirteen"
,
(
14
,
15
,
{
16
:
17
,
18
:
19
},
False
),
[[[[[[
None
]]]]]]]
x
=
[
12
,
"thirteen"
,
(
14
,
15
,
{
16
:
17
,
18
:
19
},
False
),
[[[[[[
None
]]]]]]]
R
(
x
,
(
x
,
58
))
...
...
test/test_ecdsa.py
View file @
4c483bd0
...
...
@@ -44,7 +44,7 @@ class Test (unittest.TestCase):
self
.
assertEqual
(
p
,
'032c26ab996dcc1645ea103015b0a9b008c434e2cf33f33748340747061ab9d107'
.
decode
(
'hex'
)
)
)
def
test_714
(
self
):
e0
=
ecdsa
(
None
)
...
...
@@ -54,7 +54,7 @@ class Test (unittest.TestCase):
d
=
h
.
digest
()
sig0
=
e0
.
sign
(
d
)
self
.
assertEqual
(
e0
.
verify
(
d
,
sig0
),
1
)
e1
=
ecdsa
(
714
)
# NID_secp256k1
e1
=
ecdsa
(
714
)
# NID_secp256k1
e1
.
set_privkey
(
test_key
)
sig1
=
e1
.
sign
(
d
)
self
.
assertEqual
(
e1
.
verify
(
d
,
sig1
),
1
)
...
...
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