protected ByteSource getPublicSalt(HashRequest request) {
            Optional<ByteSource> publicSalt = request.getSalt();

            if (publicSalt.isPresent() && !publicSalt.orElseThrow(NoSuchElementException::new).isEmpty()) {
                //a public salt was explicitly requested to be used - go ahead and use it:
                return publicSalt.orElseThrow(NoSuchElementException::new);
            }

            // generate salt if absent from the request.
            @SuppressWarnings("checkstyle:MagicNumber")
            byte[] ps = new byte[16];
            random.nextBytes(ps);

            return new SimpleByteSource(ps);
        }
Returns the public salt that should be used to compute a hash based on the specified request.
<p/>
This implementation functions as follows:
<ol>
  <li>If the request salt is not null and non-empty, this will be used, return it.</li>
  <li>If the request salt is null or empty:
    <ol><li>create a new 16-byte salt.</li></ol>
  </li>
</ol>

@param request request the request to process
@return the public salt that should be used to compute a hash based on the specified request or
{@code null} if no public salt should be used.
crypto/hash/src/main/java/org/apache/shiro/crypto/hash/SimpleHashProvider.java