package com.atlassian.bitbucket.internal.scm.git.lfs;

import java.util.regex.Pattern;

public class GitLfsUtils {

    private static final Pattern SHA256_PATTERN = Pattern.compile("[a-fA-F0-9]{64}");

    private GitLfsUtils() {
    }

    /**
     * Tests if a string is a valid SHA256 hash
     *
     * @param hash the string to check
     * @return {@code true} if the string is a valid SHA256 hash, otherwise {@code false}.
     */
    public static boolean isValidSha256(String hash) {
        return hash != null && SHA256_PATTERN.matcher(hash).matches();
    }
}
