Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
ee4e204e
Commit
ee4e204e
authored
10 years ago
by
Brian Warner
Browse files
Options
Downloads
Patches
Plain Diff
test_raw.py: hush flake8
parent
b81177c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_raw.py
+10
-2
10 additions, 2 deletions
tests/test_raw.py
with
10 additions
and
2 deletions
tests/test_raw.py
+
10
−
2
View file @
ee4e204e
...
...
@@ -16,11 +16,15 @@ from binascii import hexlify
from
nacl
import
c
import
hashlib
def
test_hash
():
msg
=
"
message
"
h1
=
c
.
crypto_hash
(
msg
)
assert
len
(
h1
)
==
c
.
crypto_hash_BYTES
assert
hexlify
(
h1
)
==
"
f8daf57a3347cc4d6b9d575b31fe6077e2cb487f60a96233c08cb479dbf31538cc915ec6d48bdbaa96ddc1a16db4f4f96f37276cfcb3510b8246241770d5952c
"
assert
hexlify
(
h1
)
==
(
"
f8daf57a3347cc4d6b9d575b31fe6077
"
"
e2cb487f60a96233c08cb479dbf31538
"
"
cc915ec6d48bdbaa96ddc1a16db4f4f9
"
"
6f37276cfcb3510b8246241770d5952c
"
)
assert
hexlify
(
h1
)
==
hashlib
.
sha512
(
msg
).
hexdigest
()
h2
=
c
.
crypto_hash_sha512
(
msg
)
...
...
@@ -29,7 +33,8 @@ def test_hash():
h3
=
c
.
crypto_hash_sha256
(
msg
)
assert
len
(
h3
)
==
c
.
crypto_hash_sha256_BYTES
assert
hexlify
(
h3
)
==
"
ab530a13e45914982b79f9b7e3fba994cfd1f3fb22f71cea1afbf02b460c6d1d
"
assert
hexlify
(
h3
)
==
(
"
ab530a13e45914982b79f9b7e3fba994
"
"
cfd1f3fb22f71cea1afbf02b460c6d1d
"
)
assert
hexlify
(
h3
)
==
hashlib
.
sha256
(
msg
).
hexdigest
()
...
...
@@ -43,6 +48,7 @@ def test_secretbox():
msg2
=
c
.
crypto_secretbox_open
(
ct
,
nonce
,
key
)
assert
msg2
==
msg
def
test_box
():
A_pubkey
,
A_secretkey
=
c
.
crypto_box_keypair
()
assert
len
(
A_secretkey
)
==
c
.
crypto_box_SECRETKEYBYTES
...
...
@@ -86,12 +92,14 @@ def test_sign():
msg2
=
c
.
crypto_sign_open
(
sigmsg
,
pubkey
)
assert
msg2
==
msg
def
secret_scalar
():
pubkey
,
secretkey
=
c
.
crypto_box_keypair
()
assert
len
(
secretkey
)
==
c
.
crypto_box_SECRETKEYBYTES
assert
c
.
crypto_box_SECRETKEYBYTES
==
c
.
crypto_scalarmult_BYTES
return
secretkey
,
pubkey
def
test_scalarmult
():
x
,
xpub
=
secret_scalar
()
assert
len
(
x
)
==
32
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment