Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Source_Encoding
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
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
Show more breadcrumbs
dnarXiv
Source_Encoding
Commits
c527d62c
Commit
c527d62c
authored
3 years ago
by
BOULLE Olivier
Browse files
Options
Downloads
Patches
Plain Diff
typings
parent
27c516ea
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
hashing.py
+4
-5
4 additions, 5 deletions
hashing.py
with
4 additions
and
5 deletions
hashing.py
+
4
−
5
View file @
c527d62c
...
...
@@ -6,8 +6,7 @@ use SHA256 hashing on sequences
"""
def
base10_to_lower_base_convert
(
i
,
base
):
def
base10_to_lower_base_convert
(
i
:
int
,
base
:
int
)
->
str
:
"""
return the number i written in a lower base
"""
...
...
@@ -18,7 +17,7 @@ def base10_to_lower_base_convert(i, base):
return
""
.
join
(
result
)
def
base16_to_base4
(
base16_hash
)
:
def
base16_to_base4
(
base16_hash
:
str
)
->
str
:
"""
convert a string representing a number in base 16 to a string representing a number in base 4
"""
...
...
@@ -27,7 +26,7 @@ def base16_to_base4(base16_hash):
return
base4_hash
def
hash_string_to_formated_base4
(
input_string
,
hash_size
)
:
def
hash_string_to_formated_base4
(
input_string
:
str
,
hash_size
:
int
)
->
str
:
"""
apply SHA256 hashing to a string to get a hash in base4 and of a specified size
a basic hash is 64 long (base 16); so 128 long when reduced to base 4
...
...
@@ -50,7 +49,7 @@ def hash_string_to_formated_base4(input_string, hash_size):
return
base4_total_hash
[:
hash_size
]
# remove excess size
def
sha256_hash
(
input_string
)
:
def
sha256_hash
(
input_string
:
str
)
->
str
:
"""
SHA256 hashing, result is in base 16
"""
...
...
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