protected ByteSource toByteSource(Object object) {
        if (object instanceof ByteSource) {
            return (ByteSource) object;
        }
        byte[] bytes = toBytes(object);
        return ByteSource.Util.bytes(bytes);
    }
Converts a given object into a {@code ByteSource} instance.  Assumes the object can be converted to bytes.

@param object the Object to convert into a {@code ByteSource} instance.
@return the {@code ByteSource} representation of the specified object's bytes.
@since 1.2
crypto/hash/src/main/java/org/apache/shiro/crypto/hash/SimpleHash.java