Example usage for com.google.common.hash Hashing sha256

List of usage examples for com.google.common.hash Hashing sha256

Introduction

In this page you can find the example usage for com.google.common.hash Hashing sha256.

Prototype

public static HashFunction sha256() 

Source Link

Document

Returns a hash function implementing the SHA-256 algorithm (256 hash bits) by delegating to the SHA-256 MessageDigest .

Usage

From source file:EntityAndQueries.Queries.java

private static String Hashing(String password) {
    HashFunction function = Hashing.sha256();
    HashCode code = (HashCode) function.newHasher().putString(password, Charsets.UTF_8).hash();
    String passWord1 = code.toString();
    return passWord1;
}

From source file:org.elasticsearch.plugin.readonlyrest.acl.blocks.rules.impl.AuthKeySha256SyncRule.java

@Override
protected HashFunction getHashFunction() {
    return Hashing.sha256();
}

From source file:tech.beshu.ror.acl.definitions.ldaps.LdapCredentials.java

public String getHashedPassword() {
    return Hashing.sha256().hashString(password, Charset.defaultCharset()).toString();
}

From source file:com.android.tools.idea.LogAnonymizerUtil.java

/**
 * Returns a hash for the given class name. The hash value will be consistent only for the current session. Once the IDE is shutdown,
 * the hash for the class name will change.
 *///  w ww  . ja va 2s .c o m
@NotNull
public static String anonymizeClassName(@Nullable String className) {
    if (className == null) {
        return "null";
    }

    className = className.replace("/", ".");
    return isPublicClass(className) ? className
            : "class:" + Hashing.sha256().hashString(SALT + className, StandardCharsets.UTF_8).toString();
}

From source file:org.talos.CFGScanDroid.Match.java

public Match(File file, CFGSig signature, ControlFlowGraph cfg) {
    this.fileName = file.getPath();
    try {/*  w  w  w  .j  a va  2 s  . c om*/
        this.fileMD5 = Files.hash(file, Hashing.md5()).toString();
        this.fileSHA256 = Files.hash(file, Hashing.sha256()).toString();
    } catch (IOException e) {
        e.printStackTrace();
    }
    this.cfg = cfg;
    this.signature = signature;
}

From source file:edu.cmu.lti.oaqa.framework.eval.Key.java

public String hashString() {
    HashFunction hf = Hashing.sha256();
    Hasher hasher = hf.newHasher();/*  w  ww.j a  va2  s.  c  o  m*/
    hasher.putString(getExperiment());
    hasher.putString(getTrace().getTrace());
    HashCode hash = hasher.hash();
    return hash.toString();
}

From source file:edu.iit.sat.itmd4515.yganorkar.domain.security.User.java

@PrePersist
@PreUpdate//ww  w . j  ava 2s.c o m
private void passwordHash() {
    String sha256Password = Hashing.sha256().hashString(this.password, StandardCharsets.UTF_8).toString();
    this.password = sha256Password;
}

From source file:ddf.security.listener.AuditingHttpSessionListener.java

@Override
public void sessionDestroyed(HttpSessionEvent se) {
    HttpSession session = se.getSession();

    SecurityLogger.audit("Session {} destroyed.",
            Hashing.sha256().hashString(session.getId(), StandardCharsets.UTF_8).toString());
}

From source file:tech.beshu.ror.acl.definitions.externalauthenticationservices.CachedExternalAuthenticationServiceClient.java

private static String hashFrom(String password) {
    return Hashing.sha256().hashString(password, Charset.defaultCharset()).toString();
}

From source file:com.facebook.buck.file.FileHash.java

/** Get the hash function for this type of hash */
public HashFunction getHashFunction() {
    if (sha1OrSha256.isLeft()) {
        return Hashing.sha1();
    } else {//from  w  w  w.ja v  a 2 s  .c o  m
        return Hashing.sha256();
    }
}