<commit_before>package com.qingstor.sdk.util

import java.security.MessageDigest
import java.util.Base64

object SecurityUtil {
  def getMD5(string: String): Array[Byte] = {
    MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"))
  }

  def encodeToBase64String(bytes: Array[Byte]): String = {
    Base64.getEncoder.encodeToString(bytes)
  }
}<commit_msg>add getHmacSHA256<commit_after>package com.qingstor.sdk.util

import java.security.MessageDigest
import java.util.Base64
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec

object SecurityUtil {
  def getMD5(string: String): Array[Byte] = {
    MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"))
  }

  def getHmacSHA256(key: String, content: String): Array[Byte] = {
    val secret = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256")
    val mac = Mac.getInstance("HmacSHA256")
    mac.init(secret)
    mac.doFinal(content.getBytes("UTF-8"))
  }

  def encodeToBase64String(bytes: Array[Byte]): String = {
    Base64.getEncoder.encodeToString(bytes)
  }
}
{'fraction_non_alphanumeric': 0.13434247871333965, 'fraction_numerical': 0.030274361400189215, 'mean_word_length': 5.080459770114943, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2888094', 'n_tokens_mistral': 376, 'n_tokens_neox': 353, 'n_words': 57}