Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
cellframe
libdap
Commits
92d2951d
Commit
92d2951d
authored
6 years ago
by
Aleksandr Lysikov
Browse files
Options
Downloads
Patches
Plain Diff
fix decode_base58
parent
842029d3
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
crypto/dap_enc_base58.c
+10
-3
10 additions, 3 deletions
crypto/dap_enc_base58.c
crypto/dap_enc_base58.h
+1
-1
1 addition, 1 deletion
crypto/dap_enc_base58.h
with
11 additions
and
4 deletions
crypto/dap_enc_base58.c
+
10
−
3
View file @
92d2951d
...
...
@@ -59,7 +59,7 @@ size_t dap_enc_base58_decode(const char * a_in, void * a_out)
size_t
l_outi_size
=
(
l_out_size_max
+
3
)
/
4
;
uint32_t
l_outi
[
l_outi_size
];
memzero
(
l_outi
,
l_outi_size
);
memzero
(
l_outi
,
l_outi_size
*
sizeof
(
uint32_t
)
);
uint64_t
t
;
uint32_t
c
;
size_t
i
,
j
;
...
...
@@ -77,10 +77,10 @@ size_t dap_enc_base58_decode(const char * a_in, void * a_out)
{
if
(
l_in_u8
[
i
]
&
0x80
)
// High-bit set on invalid digit
return
false
;
return
0
;
if
(
c_b58digits_map
[
l_in_u8
[
i
]]
==
-
1
)
// Invalid base58 digit
return
false
;
return
0
;
c
=
(
unsigned
)
c_b58digits_map
[
l_in_u8
[
i
]];
for
(
j
=
l_outi_size
;
j
--
;
)
{
...
...
@@ -133,6 +133,13 @@ size_t dap_enc_base58_decode(const char * a_in, void * a_out)
}
--
l_out_size
;
}
// shift result to beginning of the string
for
(
j
=
0
;
j
<
l_out_size
;
j
++
){
l_out_u8
[
j
+
zerocount
]
=
l_out_u8
[
j
+
i
];
}
l_out_u8
[
j
+
zerocount
]
=
0
;
l_out_size
+=
zerocount
;
return
l_out_size
;
...
...
This diff is collapsed.
Click to expand it.
crypto/dap_enc_base58.h
+
1
−
1
View file @
92d2951d
...
...
@@ -34,7 +34,7 @@ extern "C" {
/*
* Calculates encode size from input size
*/
#define DAP_ENC_BASE58_ENCODE_SIZE(a_in_size) ( (size_t) ((137 * a_in_size / 100)+
1
))
#define DAP_ENC_BASE58_ENCODE_SIZE(a_in_size) ( (size_t) ((137 * a_in_size / 100)+
2
))
#define DAP_ENC_BASE58_DECODE_SIZE(a_in_size) ( (size_t) ( 2 * a_in_size +1) )
size_t
dap_enc_base58_encode
(
const
void
*
a_in
,
size_t
a_in_size
,
char
*
a_out
);
...
...
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