Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Commits
1f20724d
Commit
1f20724d
authored
4 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#176
: Use sha256 from hashlib from stdlib
parent
6a9bc455
No related branches found
No related tags found
1 merge request
!149
#176: Get rid of PyNaCl and use base58 module
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/crypto_tools.py
+4
-4
4 additions, 4 deletions
silkaj/crypto_tools.py
with
4 additions
and
4 deletions
silkaj/crypto_tools.py
+
4
−
4
View file @
1f20724d
...
@@ -16,7 +16,8 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
...
@@ -16,7 +16,8 @@ along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
"""
"""
import
re
import
re
from
nacl
import
encoding
,
hash
import
hashlib
from
nacl
import
encoding
from
silkaj.constants
import
PUBKEY_PATTERN
from
silkaj.constants
import
PUBKEY_PATTERN
from
silkaj.tools
import
message_exit
from
silkaj.tools
import
message_exit
...
@@ -77,9 +78,8 @@ def gen_checksum(pubkey):
...
@@ -77,9 +78,8 @@ def gen_checksum(pubkey):
Returns the checksum of the input pubkey (encoded in b58)
Returns the checksum of the input pubkey (encoded in b58)
"""
"""
pubkey_byte
=
b58_decode
(
pubkey
)
pubkey_byte
=
b58_decode
(
pubkey
)
return
b58_encode
(
hash
=
hashlib
.
sha256
(
hashlib
.
sha256
(
pubkey_byte
).
digest
()).
digest
()
hash
.
sha256
(
hash
.
sha256
(
pubkey_byte
,
encoding
.
RawEncoder
),
encoding
.
RawEncoder
)
return
b58_encode
(
hash
)[:
3
]
)[:
3
]
b58_digits
=
"
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
"
b58_digits
=
"
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
"
...
...
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