code: static String sign(String data, String key, String algorithm) {
          try {
              Mac mac = Mac.getInstance(algorithm);
              mac.init(new SecretKeySpec(key.getBytes(DEFAULT_ENCODING), algorithm));
              byte[] signature = Base64.encodeBase64(mac.doFinal(data.getBytes(DEFAULT_ENCODING)));
              String encoded = new String(signature, DEFAULT_ENCODING);
              //log.debug("\nSign:"+data+"\nKey:"+key+"\nAlgorithm:"+algorithm+"\nSignature:"+encoded);
              return encoded;
          } catch (Exception e) {
              throw MwsUtl.wrap(e);
          }
      }
docs: Computes RFC 2104-compliant HMAC signature.
  
  @param data
  The data to sign.
  @param key
  The key to use for signing.
  
  @param algorithm
  The signing algorithm.
  
  @return The signature.