diff options
author | Alex Auvolat <alex@adnab.me> | 2018-09-25 19:57:35 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-09-25 19:57:35 +0200 |
commit | 78e5caa664b860189ea86f95fe68ad5e6705897b (patch) | |
tree | c2d932af6ed1451b6c4bc11ebbe37ddc7ac8f90b /shard/lib/data | |
parent | bfdcc107028f64d3d4a6e38ae9732d33182502d6 (diff) | |
download | shard-78e5caa664b860189ea86f95fe68ad5e6705897b.tar.gz shard-78e5caa664b860189ea86f95fe68ad5e6705897b.zip |
s/block/page, change semantics to use more binaries, fixes
Diffstat (limited to 'shard/lib/data')
-rw-r--r-- | shard/lib/data/data.ex | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/shard/lib/data/data.ex b/shard/lib/data/data.ex index c2c659d..78c73cd 100644 --- a/shard/lib/data/data.ex +++ b/shard/lib/data/data.ex @@ -18,6 +18,18 @@ defmodule SData do :crypto.hash(algo, (:erlang.term_to_binary term)) end + def term_bin(term) do + :erlang.term_to_binary term + end + + def bin_hash(bin, algo \\ :sha256) do + :crypto.hash(algo, bin) + end + + def term_unbin(bin) do + :erlang.binary_to_term(bin, [:safe]) + end + @doc""" Compare function for arbitrary terms using the Erlang order """ |