test_class.file: restx-common/src/test/java/restx/common/CryptoTest.java
test_class.identifier: CryptoTest
test_case.body: @Test
      public void testSign() throws Exception {
          String signature = Crypto.sign("My message to sign", "my grain of salt".getBytes(Charsets.UTF_8.name()));
  
          assertThat(signature)
                  .isNotNull()
                  .isEqualTo("yIDXrtZ71qCfHnUNvlYSS//0YPE=")
                  .isEqualTo(Crypto.sign("My message to sign", "my grain of salt".getBytes(Charsets.UTF_8.name())));
      }
test_case.class_method_signature: CryptoTest.testSign()
test_case.full_signature: @Test public void testSign()
test_case.identifier: testSign
test_case.invocations: sign getBytes name isEqualTo isEqualTo isNotNull assertThat sign getBytes name
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSign()
focal_class.file: restx-common/src/main/java/restx/common/Crypto.java
focal_class.identifier: Crypto
focal_class.class_method_signature: Crypto.sign(String message, byte[] key)
focal_class.full_signature: public static String sign(String message, byte[] key)
focal_class.identifier: sign
focal_class.modifiers: public static
focal_class.parameters: (String message, byte[] key)
focal_class.return: String
focal_class.signature: String sign(String message, byte[] key)
focal_method.body: public static String sign(String message, byte[] key) {
          if (key.length == 0) {
              return message;
          }
  
          try {
              Mac mac = Mac.getInstance("HmacSHA1");
              SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1");
              mac.init(signingKey);
              byte[] messageBytes = message.getBytes(Charsets.UTF_8);
              byte[] result = mac.doFinal(messageBytes);
              return BaseEncoding.base64().encode(result);
          } catch (Exception ex) {
              throw new RuntimeException(ex);
          }
      }
focal_method.class_method_signature: Crypto.sign(String message, byte[] key)
focal_method.full_signature: public static String sign(String message, byte[] key)
focal_method.identifier: sign
focal_method.invocations: getInstance init getBytes doFinal encode base64
focal_method.modifiers: public static
focal_method.parameters: (String message, byte[] key)
focal_method.return: String
focal_method.signature: String sign(String message, byte[] key)