Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mf
go-multiaddr
Commits
ebd6de6a
Commit
ebd6de6a
authored
Apr 05, 2019
by
idk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the padding
parent
42839924
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
transcoders.go
transcoders.go
+11
-4
No files found.
transcoders.go
View file @
ebd6de6a
...
...
@@ -262,11 +262,18 @@ func garlic32StB(s string) ([]byte, error) {
}
}
//compute the length to pad the address to, usually 56 or 64
x
:=
int
((
len
(
s
)
/
8
)
+
1
)
*
8
for
len
(
s
)
<
x
{
s
+=
"="
padout
:=
func
(
s
string
)
string
{
if
len
(
s
)
%
8
==
0
{
return
s
}
x
:=
int
((
len
(
s
)
/
8
)
+
1
)
*
8
for
len
(
s
)
<
x
{
s
+=
"="
}
return
s
}
garlicHostBytes
,
err
:=
garlicBase32Encoding
.
DecodeString
(
s
[
0
:
56
])
garlicHostBytes
,
err
:=
garlicBase32Encoding
.
DecodeString
(
padout
(
s
))
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to decode base32 garlic addr: %s, err: %v len: %v"
,
s
,
err
,
len
(
s
))
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment