@@ -0,0 +1,1512 @@
+package com.wemote.scorpio.modules.utils.crypto;%0A%0Aimport org.apache.commons.codec.binary.Hex;%0A%0Aimport javax.crypto.Mac;%0Aimport javax.crypto.SecretKey;%0Aimport javax.crypto.spec.SecretKeySpec;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * @author jayon.xu@gmail.com%0A */%0Apublic class HmacSHA256Utils %7B%0A%0A    public static String digest(String key, String content) %7B%0A        try %7B%0A            Mac mac = Mac.getInstance(%22HmacSHA256%22);%0A            byte%5B%5D secretByte = key.getBytes(%22utf-8%22);%0A            byte%5B%5D dataBytes = content.getBytes(%22utf-8%22);%0A%0A            SecretKey secret = new SecretKeySpec(secretByte, %22HMACSHA256%22);%0A            mac.init(secret);%0A%0A            byte%5B%5D doFinal = mac.doFinal(dataBytes);%0A            byte%5B%5D hexB = new Hex().encode(doFinal);%0A            return new String(hexB, %22utf-8%22);%0A        %7D catch (Exception e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A    %7D%0A%0A    public static String digest(String key, Map%3CString, ?%3E map) %7B%0A        StringBuilder s = new StringBuilder();%0A        for (Object values : map.values()) %7B%0A            if (values instanceof String%5B%5D) %7B%0A                for (String value : (String%5B%5D) values) %7B%0A                    s.append(value);%0A                %7D%0A            %7D else if (values instanceof List) %7B%0A                for (String value : (List%3CString%3E) values) %7B%0A                    s.append(value);%0A                %7D%0A            %7D else %7B%0A                s.append(values);%0A            %7D%0A        %7D%0A        return digest(key, s.toString());%0A    %7D%0A%0A%7D%0A

Add hmacsha256 function.