Tabnine Logo
StringUtils.sha1Hash
Code IndexAdd Tabnine to your IDE (free)

How to use
sha1Hash
method
in
org.stagemonitor.util.StringUtils

Best Java code snippets using org.stagemonitor.util.StringUtils.sha1Hash (Showing top 3 results out of 315)

origin: stagemonitor/stagemonitor

private void setTrackingInformation(Span span, HttpServletRequest httpServletRequest, String clientIp, String userAgenHeader) {
  final String userName = getUserName(httpServletRequest);
  final String sessionId = getSessionId(httpServletRequest);
  span.setTag(SpanUtils.USERNAME, userName);
  span.setTag("session_id", sessionId);
  if (userName != null) {
    span.setTag("tracking.unique_visitor_id", StringUtils.sha1Hash(userName));
  } else {
    span.setTag("tracking.unique_visitor_id", StringUtils.sha1Hash(clientIp + sessionId + userAgenHeader));
  }
  SpanUtils.setClientIp(span, clientIp);
}
origin: stagemonitor/stagemonitor

  @Test
  public void testSha1Hash() throws Exception {
    // result from org.apache.commons.codec.digest.DigestUtils.sha1Hex
    assertEquals("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", StringUtils.sha1Hash("test"));
  }
}
origin: stagemonitor/stagemonitor

@Override
public void onFinish(SpanWrapper spanWrapper, String operationName, long durationNanos) {
  final boolean pseudonymizeUserNames = tracingPlugin.isPseudonymizeUserNames();
  final boolean anonymizeIPs = tracingPlugin.isAnonymizeIPs();
  if (!anonymizeIPs && !pseudonymizeUserNames) {
    return;
  }
  final String username = spanWrapper.getStringTag(SpanUtils.USERNAME);
  String hashedUserName = username;
  if (pseudonymizeUserNames) {
    hashedUserName = StringUtils.sha1Hash(username);
    spanWrapper.setTag(SpanUtils.USERNAME, hashedUserName);
  }
  final boolean disclose = tracingPlugin.getDiscloseUsers().contains(hashedUserName);
  if (disclose) {
    spanWrapper.setTag("username_disclosed", username);
  }
  if (anonymizeIPs && !disclose) {
    final String ipV6Address = spanWrapper.getStringTag(Tags.PEER_HOST_IPV6.getKey());
    final Number ipV4Address = spanWrapper.getNumberTag(Tags.PEER_HOST_IPV4.getKey());
    if (ipV6Address != null) {
      Tags.PEER_HOST_IPV6.set(spanWrapper, IPAnonymizationUtils.anonymize(ipV6Address));
    } else if (ipV4Address != null) {
      final Inet4Address anonymizedIp = IPAnonymizationUtils.anonymizeIpV4Address(InetAddresses.fromInteger(ipV4Address.intValue()));
      Tags.PEER_HOST_IPV4.set(spanWrapper, InetAddresses.inetAddressToInt(anonymizedIp));
    }
  }
}
org.stagemonitor.utilStringUtilssha1Hash

Popular methods of StringUtils

  • isEmpty
  • getLogstashStyleDate
  • isNotEmpty
  • asCsv
  • removeStart
  • removeTrailingSlash
  • replaceWhitespacesWithDash
  • timestampAsIsoString
  • toCommaSeparatedString
  • bytesToHex
  • capitalize
  • dateAsIsoString
  • capitalize,
  • dateAsIsoString,
  • slugify,
  • split,
  • splitCamelCase

Popular in Java

  • Updating database using SQL prepared statement
  • setContentView (Activity)
  • getApplicationContext (Context)
  • onRequestPermissionsResult (Fragment)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Permission (java.security)
    Legacy security code; do not use.
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JButton (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now