What hash? Okio has some of those built in
# squarelibraries
j
What hash? Okio has some of those built in
s
I know that the jvm has the
CipherSource
and a
DigestSource
(I think). I didn’t see any of that on multiplatform though. I’m just getting MD5 checksums.
Did I miss something available in the okio api?
There's also a HashingSink into which you can send the file's contents
s
You are right! I didn’t know that.
I can’t use
ByteString
because the files are potentially very large, and I can’t load the entire file into memory. I want to read a file contents and get the hash. What can I use as the
Sink
when I don’t actually want to do anything with the data? Is there a NoOpSink or an EmptySink?
j
There's a blackhole sink, yes. I think it's a top-level factory method
s
oh - what the heck. I definitely looked for this earlier. I just found
HashingSource
in the common layer too.
Maybe my IDE glitched and didn’t give me proper completion while I was looking for these. Either way - I’m glad okio provides these in a multiplatform way. It’s far more convenient.