In my Spring Boot app, I am generating a Pdf from Html content and store it on cloud and return the generated file to the front-end. As the data that is used for generation may change in the next time, I should delete the generated file from the cloud. Or, I can generate a key that is created using a uuid and Html data. With the help of this, at first I can check if the generated key is already present in the cloud and retrieve that data from cloud if it is present. Otherwise generate Pdf.
I think to use some basic approach as shown below:
public int hashCode(UUID uuid, String content) {
    StringBuilder builder = new StringBuilder();
    builder.append(uuid);
    builder.append(content);
    return builder.toString().hashCode();
}
On the other hand, there may be some better solution as shown below:
private static final int NUM_BITS = 256;
private static final int RADIX = 36;
private static final SecureRandom secureRandom = new SecureRandom();
private static String generateKey() {
    return new BigInteger(NUM_BITS, secureRandom).toString(RADIX);
}
However, I don't know if I can pass uuid and html content to this method and use them instead of some parameter e.g. NUM_BITS.
1. As I generate pdf for a specific product, I think it is good idea to use uuid of that product for creating hash key besides generated Pdf content. Am I wrong?
2. Which one is the most proper way to create a hashkey? If the approaches above is not a proper ones, what would you suggest?
I might also consider using How to generate a random alpha-numeric string, but not sure which one is the most proper way for my situation?
