~singpolyma/cheogram-android

636bc67aab957dc56ce4539b66ebff8cfffbcf1a — Stephen Paul Weber 3 months ago f5b01ad
sha-1 is the standard name sha1 is just for bob
M src/cheogram/java/com/cheogram/android/BobTransfer.java => src/cheogram/java/com/cheogram/android/BobTransfer.java +8 -1
@@ 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) {

M src/main/java/eu/siacs/conversations/utils/CryptoHelper.java => src/main/java/eu/siacs/conversations/utils/CryptoHelper.java +1 -1
@@ 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: