From 61d62da9f084432ba0bc91f0717c1d92acd5dcee Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 22 Feb 2023 23:20:04 +0100 Subject: [PATCH 1/2] Make poseidon hashes good hashes This hash function is heavily used by Filecoin, making Kubo unable to operate with Filecoin data. This commit was moved from ipfs/go-verifcid@d55ee9d460b3be77ec753ec6f0927be9c154612c --- verifcid/validate.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/verifcid/validate.go b/verifcid/validate.go index 7b27debc94..02a48b200d 100644 --- a/verifcid/validate.go +++ b/verifcid/validate.go @@ -15,20 +15,21 @@ const minimumHashLength = 20 const maximumHashLength = 128 var goodset = map[uint64]bool{ - mh.SHA2_256: true, - mh.SHA2_512: true, - mh.SHA3_224: true, - mh.SHA3_256: true, - mh.SHA3_384: true, - mh.SHA3_512: true, - mh.SHAKE_256: true, - mh.DBL_SHA2_256: true, - mh.KECCAK_224: true, - mh.KECCAK_256: true, - mh.KECCAK_384: true, - mh.KECCAK_512: true, - mh.BLAKE3: true, - mh.IDENTITY: true, + mh.SHA2_256: true, + mh.SHA2_512: true, + mh.SHA3_224: true, + mh.SHA3_256: true, + mh.SHA3_384: true, + mh.SHA3_512: true, + mh.SHAKE_256: true, + mh.DBL_SHA2_256: true, + mh.KECCAK_224: true, + mh.KECCAK_256: true, + mh.KECCAK_384: true, + mh.KECCAK_512: true, + mh.BLAKE3: true, + mh.IDENTITY: true, + mh.POSEIDON_BLS12_381_A1_FC1: true, mh.SHA1: true, // not really secure but still useful } From 8f28875eec44d5729ce5cb0b188926d7566ee7d7 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 22 Feb 2023 23:30:33 +0100 Subject: [PATCH 2/2] Add SHA2_256_TRUNC254_PADDED and X11 (additional filecoin hashes) This commit was moved from ipfs/go-verifcid@4c96c9345d7c202cede5bdd17280aede61ea18b6 --- verifcid/validate.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/verifcid/validate.go b/verifcid/validate.go index 02a48b200d..9164d6d85e 100644 --- a/verifcid/validate.go +++ b/verifcid/validate.go @@ -30,6 +30,8 @@ var goodset = map[uint64]bool{ mh.BLAKE3: true, mh.IDENTITY: true, mh.POSEIDON_BLS12_381_A1_FC1: true, + mh.SHA2_256_TRUNC254_PADDED: true, + mh.X11: true, mh.SHA1: true, // not really secure but still useful }