List of usage examples for com.google.common.hash Hashing sha1
public static HashFunction sha1()
From source file:com.facebook.buck.features.apple.project.ProjectGenerator.java
private static Path getDerivedSourcesDirectoryForBuildTarget(BuildTarget buildTarget, ProjectFilesystem fs) { String fullTargetName = buildTarget.getFullyQualifiedName(); byte[] utf8Bytes = fullTargetName.getBytes(Charset.forName("UTF-8")); Hasher hasher = Hashing.sha1().newHasher(); hasher.putBytes(utf8Bytes);/* www . j ava 2 s . c om*/ String targetSha1Hash = hasher.hash().toString(); String targetFolderName = buildTarget.getShortName() + "-" + targetSha1Hash; Path xcodeDir = fs.getBuckPaths().getXcodeDir(); Path derivedSourcesDir = xcodeDir.resolve("derived-sources").resolve(targetFolderName); return derivedSourcesDir; }
From source file:com.facebook.buck.features.apple.project.ProjectGenerator.java
private Path getFilenameToHeadersPath(TargetNode<? extends CxxLibraryDescription.CommonArg> targetNode, String suffix) {/* ww w .ja v a2s .c o m*/ String hashedPath = BaseEncoding.base64Url().omitPadding() .encode(Hashing.sha1() .hashString(targetNode.getBuildTarget().getUnflavoredBuildTarget().getFullyQualifiedName(), Charsets.UTF_8) .asBytes()) .substring(0, 10); return Paths.get(hashedPath + suffix); }