ScramSha512.java

 1package eu.siacs.conversations.crypto.sasl;
 2
 3import com.google.common.hash.HashFunction;
 4import com.google.common.hash.Hashing;
 5
 6import org.bouncycastle.crypto.Digest;
 7import org.bouncycastle.crypto.digests.SHA512Digest;
 8import org.bouncycastle.crypto.macs.HMac;
 9
10import eu.siacs.conversations.entities.Account;
11
12public class ScramSha512 extends ScramMechanism {
13
14    public static final String MECHANISM = "SCRAM-SHA-512";
15
16    public ScramSha512(final Account account) {
17        super(account, ChannelBinding.NONE);
18    }
19
20    @Override
21    protected HashFunction getHMac(final byte[] key) {
22        return Hashing.hmacSha512(key);
23    }
24
25    @Override
26    protected HashFunction getDigest() {
27        return Hashing.sha512();
28    }
29
30    @Override
31    public int getPriority() {
32        return 30;
33    }
34
35    @Override
36    public String getMechanism() {
37        return MECHANISM;
38    }
39}