org.jgroups.util.Util.sha()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(201)

本文整理了Java中org.jgroups.util.Util.sha()方法的一些代码示例,展示了Util.sha()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.sha()方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:sha

Util.sha介绍

[英]Converts a java.lang.String in to a SHA hashed String
[中]转换java。lang.将字符串插入到SHA散列字符串中

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * Called during setup to hash the auth_value string in to an MD5/SHA hash
 *
 * @param token
 *            the string to hash
 * @return the hashed version of the string
 */
private String hash(String token) {
  // perform the hashing of the token key
  String hashedToken = null;
  if (hash_type.equalsIgnoreCase("SHA")) {
    hashedToken = Util.sha(token);
  } else {
    hashedToken = Util.md5(token);
  }
  if (hashedToken == null) {
    // failed to hash - sending the token in clear text
    // Note that this may be considered a security vulnerabiltiy if clear text passwords are forbidden.
    log.warn("Failed to hash token - sending in clear text");
    return token;
  }
  return hashedToken;
}

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

/**
 * Called during setup to hash the auth_value string in to an MD5/SHA hash
 * @param token the string to hash
 * @return the hashed version of the string
 */
private String hash(String token){
  //perform the hashing of the token key
  String hashedToken = null;
  if(hash_type.equalsIgnoreCase("SHA")){
    hashedToken = Util.sha(token);
  }else{
    hashedToken = Util.md5(token);
  }
  if(hashedToken == null){
    //failed to encrypt
    if(log.isWarnEnabled()){
      log.warn("Failed to hash token - sending in clear text");
    }
    return token;
  }
  return hashedToken;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Called during setup to hash the auth_value string in to an MD5/SHA hash
 *
 * @param token
 *            the string to hash
 * @return the hashed version of the string
 */
private String hash(String token) {
  // perform the hashing of the token key
  String hashedToken = null;
  if (hash_type.equalsIgnoreCase("SHA")) {
    hashedToken = Util.sha(token);
  } else {
    hashedToken = Util.md5(token);
  }
  if (hashedToken == null) {
    // failed to hash - sending the token in clear text
    // Note that this may be considered a security vulnerabiltiy if clear text passwords are forbidden.
    log.warn("Failed to hash token - sending in clear text");
    return token;
  }
  return hashedToken;
}

相关文章

Util类方法