    for (Variant chunk = HHVM_FN(fread)(f.toResource(), 1024);
         !is_empty_string(chunk.asTypedValue());
         chunk = HHVM_FN(fread)(f.toResource(), 1024)) {
      String schunk = chunk.toString();
      ops->hash_update(context, (unsigned char *)schunk.data(), schunk.size());
    }
  } else {
    ops->hash_update(context, (unsigned char *)data.data(), data.size());