Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

15 lines (11 sloc) 0.432 kb
-module(luwak_checksum).
-export([sha1/2]).
sha1(Riak, File) ->
Length = luwak_file:length(Riak, File),
sha1_int(crypto:sha_init(), luwak_get_stream:start(Riak, File, 0, Length)).
sha1_int(Ctx, GetStream) ->
case luwak_get_stream:recv(GetStream, 1000) of
{error, timeout} -> {error, timeout};
eos -> crypto:sha_final(Ctx);
{Data, _} -> sha1_int(crypto:sha_update(Ctx,Data),GetStream)
end.
Jump to Line
Something went wrong with that request. Please try again.