1package eu.siacs.conversations.crypto.sasl;
2
3import com.google.common.hash.HashFunction;
4import com.google.common.hash.Hashing;
5
6import eu.siacs.conversations.entities.Account;
7
8public class ScramSha512Plus extends ScramPlusMechanism {
9
10 public static final String MECHANISM = "SCRAM-SHA-512-PLUS";
11
12 public ScramSha512Plus(final Account account, final ChannelBinding channelBinding) {
13 super(account, channelBinding);
14 }
15
16 @Override
17 protected HashFunction getHMac(final byte[] key) {
18 return (key == null || key.length == 0)
19 ? Hashing.hmacSha512(EMPTY_KEY)
20 : Hashing.hmacSha512(key);
21 }
22
23 @Override
24 protected HashFunction getDigest() {
25 return Hashing.sha512();
26 }
27
28 @Override
29 public int getPriority() {
30 return 45 + ChannelBinding.priority(this.channelBinding);
31 }
32
33 @Override
34 public String getMechanism() {
35 return MECHANISM;
36 }
37}