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
dms3
go-verifcid
Commits
280ec1f7
Commit
280ec1f7
authored
Sep 05, 2018
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gx update go-cid and fix code to use new Cid type
parent
f9c8f6d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
package.json
package.json
+2
-2
validate.go
validate.go
+1
-1
validate_test.go
validate_test.go
+2
-2
No files found.
package.json
View file @
280ec1f7
...
...
@@ -13,9 +13,9 @@
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"Qm
ZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb
"
,
"hash"
:
"Qm
PSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7
"
,
"name"
:
"go-cid"
,
"version"
:
"0.
8
.0"
"version"
:
"0.
9
.0"
}
],
"gxVersion"
:
"0.12.1"
,
...
...
validate.go
View file @
280ec1f7
...
...
@@ -48,7 +48,7 @@ func IsGoodHash(code uint64) bool {
return
false
}
func
ValidateCid
(
c
*
cid
.
Cid
)
error
{
func
ValidateCid
(
c
cid
.
Cid
)
error
{
pref
:=
c
.
Prefix
()
if
!
IsGoodHash
(
pref
.
MhType
)
{
return
ErrPossiblyInsecureHashFunction
...
...
validate_test.go
View file @
280ec1f7
...
...
@@ -32,7 +32,7 @@ func TestValidateCids(t *testing.T) {
assertFalse
(
IsGoodHash
(
mh
.
BLAKE2B_MIN
+
5
))
mhcid
:=
func
(
code
uint64
,
length
int
)
*
cid
.
Cid
{
mhcid
:=
func
(
code
uint64
,
length
int
)
cid
.
Cid
{
mhash
,
err
:=
mh
.
Sum
([]
byte
{},
code
,
length
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -41,7 +41,7 @@ func TestValidateCids(t *testing.T) {
}
cases
:=
[]
struct
{
cid
*
cid
.
Cid
cid
cid
.
Cid
err
error
}{
{
mhcid
(
mh
.
SHA2_256
,
32
),
nil
},
...
...
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