Current section

Files

Jump to
piazza_core lib file file.ex
Raw

lib/file/file.ex

defmodule Piazza.File do
def hash(path) do
File.stream!(path)
|> Enum.reduce(:crypto.hash_init(:sha256), &:crypto.hash_update(&2, &1))
|> :crypto.hash_final()
|> Base.encode16()
|> String.downcase()
end
end