protected BucketId( String nameString, int length ) { String sha1 = SecureHash.sha1(nameString); this.id = sha1.substring(0, length); }
protected BucketId( String nameString, int length ) { String sha1 = SecureHash.sha1(nameString); this.id = sha1.substring(0, length); }
public static String keyForSourceName( String name ) { return SecureHash.sha1(name).substring(0, NodeKey.SOURCE_LENGTH); }
public static String keyForWorkspaceName( String name ) { return SecureHash.sha1(name).substring(0, NodeKey.WORKSPACE_LENGTH); }
public static String keyForSourceName( String name ) { return SecureHash.sha1(name).substring(0, NodeKey.SOURCE_LENGTH); }
public static String keyForWorkspaceName( String name ) { return SecureHash.sha1(name).substring(0, NodeKey.WORKSPACE_LENGTH); }
/** * Get the SHA-1 hash of the {@link #getIdentifier() identifier}. * * @return the hexadecimal representation of the identifier's SHA-1 hash; never null */ public String getIdentifierHash() { return SecureHash.sha1(getIdentifier()); }
/** * Get the SHA-1 hash of the {@link #getIdentifier() identifier}. * * @return the hexadecimal representation of the identifier's SHA-1 hash; never null */ public String getIdentifierHash() { return SecureHash.sha1(getIdentifier()); }
/** * Computes the SHA1 for the given file. By default, this method will look at the * {@link FileSystemConnector#contentBasedSha1()} flag and either take the URL of the file (using @see * java.util.File#toURI().toURL() and return the SHA1 of the URL string or return the SHA1 of the entire file content. * * @param file a {@link File} instance; never null * @return the SHA1 of the file. */ protected String sha1( File file ) { try { if (contentBasedSha1()) { byte[] hash = SecureHash.getHash(SecureHash.Algorithm.SHA_1, file); return StringUtil.getHexString(hash); } return SecureHash.sha1(createUrlForFile(file).toString()); } catch (Exception e) { throw new ConnectorException(e); } }
/** * Computes the SHA1 for the given file. By default, this method will look at the * {@link FileSystemConnector#contentBasedSha1()} flag and either take the URL of the file (using @see * java.util.File#toURI().toURL() and return the SHA1 of the URL string or return the SHA1 of the entire file content. * * @param file a {@link File} instance; never null * @return the SHA1 of the file. */ protected String sha1( File file ) { try { if (contentBasedSha1()) { byte[] hash = SecureHash.getHash(SecureHash.Algorithm.SHA_1, file); return StringUtil.getHexString(hash); } return SecureHash.sha1(createUrlForFile(file).toString()); } catch (Exception e) { throw new ConnectorException(e); } }
private final BinaryStore binaryStore; private final String id = SecureHash.sha1(UUID.randomUUID().toString()).substring(0, 9); private final String processId; private final Map<String, String> data;
private final BinaryStore binaryStore; private final String id = SecureHash.sha1(UUID.randomUUID().toString()).substring(0, 9); private final String processId; private final Map<String, String> data;