decode = async (bytes, decryptEntryFn, decryptPayloadFn) => {
  let cid

  if (decryptEntryFn) {
    try {
      const encryptedEntry = await Block.decode({ bytes, codec, hasher })
      bytes = await decryptEntryFn(encryptedEntry.value)
      cid = encryptedEntry.cid
    } catch (e) {
      throw new Error('Could not decrypt entry')
    }
  }

  const decodedEntry = await Block.decode({ bytes, codec, hasher })
  const entry = decodedEntry.value

  if (decryptPayloadFn) {
    try {
      const decryptedPayloadBytes = await decryptPayloadFn(entry.payload)
      const { value: decryptedPayload } = await Block.decode({ bytes: decryptedPayloadBytes, codec, hasher })
      entry._payload = entry.payload
      entry.payload = decryptedPayload
    } catch (e) {
      throw new Error('Could not decrypt payload')
    }
  }

  cid = cid || decodedEntry.cid
  const hash = cid.toString(hashStringEncoding)

  return {
    ...entry,
    hash
  }
}
Decodes a serialized Entry from bytes
@param {Uint8Array} bytes
@return {module:Log~Entry}
@memberof module:Log~Entry
@private