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

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

本文整理了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

  1. /**
  2. * Called during setup to hash the auth_value string in to an MD5/SHA hash
  3. *
  4. * @param token
  5. * the string to hash
  6. * @return the hashed version of the string
  7. */
  8. private String hash(String token) {
  9. // perform the hashing of the token key
  10. String hashedToken = null;
  11. if (hash_type.equalsIgnoreCase("SHA")) {
  12. hashedToken = Util.sha(token);
  13. } else {
  14. hashedToken = Util.md5(token);
  15. }
  16. if (hashedToken == null) {
  17. // failed to hash - sending the token in clear text
  18. // Note that this may be considered a security vulnerabiltiy if clear text passwords are forbidden.
  19. log.warn("Failed to hash token - sending in clear text");
  20. return token;
  21. }
  22. return hashedToken;
  23. }

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

  1. /**
  2. * Called during setup to hash the auth_value string in to an MD5/SHA hash
  3. * @param token the string to hash
  4. * @return the hashed version of the string
  5. */
  6. private String hash(String token){
  7. //perform the hashing of the token key
  8. String hashedToken = null;
  9. if(hash_type.equalsIgnoreCase("SHA")){
  10. hashedToken = Util.sha(token);
  11. }else{
  12. hashedToken = Util.md5(token);
  13. }
  14. if(hashedToken == null){
  15. //failed to encrypt
  16. if(log.isWarnEnabled()){
  17. log.warn("Failed to hash token - sending in clear text");
  18. }
  19. return token;
  20. }
  21. return hashedToken;
  22. }

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

  1. /**
  2. * Called during setup to hash the auth_value string in to an MD5/SHA hash
  3. *
  4. * @param token
  5. * the string to hash
  6. * @return the hashed version of the string
  7. */
  8. private String hash(String token) {
  9. // perform the hashing of the token key
  10. String hashedToken = null;
  11. if (hash_type.equalsIgnoreCase("SHA")) {
  12. hashedToken = Util.sha(token);
  13. } else {
  14. hashedToken = Util.md5(token);
  15. }
  16. if (hashedToken == null) {
  17. // failed to hash - sending the token in clear text
  18. // Note that this may be considered a security vulnerabiltiy if clear text passwords are forbidden.
  19. log.warn("Failed to hash token - sending in clear text");
  20. return token;
  21. }
  22. return hashedToken;
  23. }

相关文章

Util类方法