All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.undefinedlabs.scope.utils.HashUtils Maven / Gradle / Ivy

package com.undefinedlabs.scope.utils;

import org.apache.commons.codec.digest.DigestUtils;

public class HashUtils {

  public static String sha1Hex(final String str) {
    if (StringUtils.isEmpty(str)) {
      return null;
    }

    return DigestUtils.sha1Hex(str);
  }

  public static String sha1Hex(final String str, final int length) {
    if (StringUtils.isEmpty(str) || length < 0) {
      return null;
    }

    return HashUtils.sha1Hex(str).substring(0, length);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy