code: public static String generateSharedAccessSignatureHashForAccount(
              final String accountName, final SharedAccessAccountPolicy policy, final StorageCredentials creds)
              throws InvalidKeyException, StorageException {
          Utility.assertNotNullOrEmpty("resource", accountName);
          Utility.assertNotNull("credentials", creds);
  
          String permissions = null;
          Date startTime = null;
          Date expiryTime = null;
          IPRange ipRange = null;
          SharedAccessProtocols protocols = null;
          String services = null;
          String resourceTypes = null;
          
          if (policy != null) {
              permissions = policy.permissionsToString();
              startTime = policy.getSharedAccessStartTime();
              expiryTime = policy.getSharedAccessExpiryTime();
              ipRange = policy.getRange();
              protocols = policy.getProtocols();
              services = policy.servicesToString();
              resourceTypes = policy.resourceTypesToString();
          }
          
          
          String stringToSign = String.format("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
                  accountName, permissions == null ? Constants.EMPTY_STRING : permissions, services, resourceTypes,
                  Utility.getUTCTimeOrEmpty(startTime), Utility.getUTCTimeOrEmpty(expiryTime),
                  ipRange == null ? Constants.EMPTY_STRING : ipRange.toString(),
                  protocols == null ? Constants.EMPTY_STRING : protocols.toString(),
                  Constants.HeaderConstants.TARGET_STORAGE_VERSION);
  
          return generateSharedAccessSignatureHashHelper(stringToSign, creds);
      }
docs: Get the signature hash embedded inside the Shared Access Signature for a {@link CloudStorageAccount}.
  
  @param accountName
  The name of the account to use for the SAS.
  @param policy
  The shared access policy to hash.
  @param ipRange
  An optional range of IP addresses.
  @param protocols
  An optional restriction of allowed protocols.
  @param creds
  The {@link StorageCredentials} associated with the object.
  
  @return The signature hash embedded inside the Shared Access Signature.
  @throws InvalidKeyException
  @throws StorageException