sha-1 is the standard name sha1 is just for bob

Stephen Paul Weber created

Change summary

src/cheogram/java/com/cheogram/android/BobTransfer.java      | 9 +++++
src/main/java/eu/siacs/conversations/utils/CryptoHelper.java | 2 
2 files changed, 9 insertions(+), 2 deletions(-)

Detailed changes

src/cheogram/java/com/cheogram/android/BobTransfer.java 🔗

@@ -13,6 +13,7 @@ import java.net.URISyntaxException;
 import java.security.NoSuchAlgorithmException;
 
 import io.ipfs.cid.Cid;
+import io.ipfs.multihash.Multihash;
 
 import eu.siacs.conversations.Config;
 import eu.siacs.conversations.R;
@@ -57,7 +58,13 @@ public class BobTransfer implements Transferable {
 	}
 
 	public static URI uri(Cid cid) throws NoSuchAlgorithmException, URISyntaxException {
-		return new URI("cid", CryptoHelper.multihashAlgo(cid.getType()) + "+" + CryptoHelper.bytesToHex(cid.getHash()) + "@bob.xmpp.org", null);
+		return new URI("cid", multihashAlgo(cid.getType()) + "+" + CryptoHelper.bytesToHex(cid.getHash()) + "@bob.xmpp.org", null);
+	}
+
+	private static String multihashAlgo(Multihash.Type type) throws NoSuchAlgorithmException {
+		final String algo = CryptoHelper.multihashAlgo(type);
+		if (algo.equals("sha-1")) return "sha1";
+		return algo;
 	}
 
 	public BobTransfer(URI uri, Account account, Jid to, XmppConnectionService xmppConnectionService) {

src/main/java/eu/siacs/conversations/utils/CryptoHelper.java 🔗

@@ -293,7 +293,7 @@ public final class CryptoHelper {
     public static String multihashAlgo(Multihash.Type type) throws NoSuchAlgorithmException {
         switch(type) {
         case sha1:
-            return "sha1";
+            return "sha-1";
         case sha2_256:
             return "sha-256";
         case sha2_512: