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
6eef06aa
Commit
6eef06aa
authored
12 years ago
by
Donald Stufft
Browse files
Options
Downloads
Plain Diff
Merge pull request
#2
from dstufft/fix-strings-with-nulls
Properly handle strings with internal nul
parents
225976c1
ab404970
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nacl/hash.py
+2
-2
2 additions, 2 deletions
nacl/hash.py
nacl/random.py
+1
-1
1 addition, 1 deletion
nacl/random.py
with
3 additions
and
3 deletions
nacl/hash.py
+
2
−
2
View file @
6eef06aa
...
...
@@ -8,7 +8,7 @@ def sha256(message, binary=False):
digest
=
nacl
.
ffi
.
new
(
"
unsigned char[]
"
,
nacl
.
lib
.
crypto_hash_sha256_BYTES
)
if
not
nacl
.
lib
.
crypto_hash_sha256
(
digest
,
message
,
len
(
message
)):
raise
CryptoError
(
"
Hashing failed
"
)
digest
=
nacl
.
ffi
.
string
(
digest
)
digest
=
nacl
.
ffi
.
buffer
(
digest
,
nacl
.
lib
.
crypto_hash_sha256_BYTES
)[:]
if
binary
:
return
digest
...
...
@@ -19,7 +19,7 @@ def sha512(message, binary=False):
digest
=
nacl
.
ffi
.
new
(
"
unsigned char[]
"
,
nacl
.
lib
.
crypto_hash_sha512_BYTES
)
if
not
nacl
.
lib
.
crypto_hash_sha512
(
digest
,
message
,
len
(
message
)):
raise
CryptoError
(
"
Hashing failed
"
)
digest
=
nacl
.
ffi
.
string
(
digest
)
digest
=
nacl
.
ffi
.
buffer
(
digest
,
nacl
.
lib
.
crypto_hash_sha512_BYTES
)[:]
if
binary
:
return
digest
...
...
This diff is collapsed.
Click to expand it.
nacl/random.py
+
1
−
1
View file @
6eef06aa
...
...
@@ -4,4 +4,4 @@ from . import nacl
def
random
(
size
=
32
):
data
=
nacl
.
ffi
.
new
(
"
unsigned char[]
"
,
size
)
nacl
.
lib
.
randombytes
(
data
,
size
)
return
nacl
.
ffi
.
string
(
data
)
return
nacl
.
ffi
.
buffer
(
data
,
size
)[:]
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