1: -module(sha_SUITE). 2: -compile([export_all, nowarn_export_all]). 3: 4: -include_lib("proper/include/proper.hrl"). 5: -import(prop_helper, [prop/2]). 6: 7: all() -> 8: [ sanity_check, 9: always_produces_well_formed_output 10: ]. 11: 12: sanity_check(_) -> 13: %% @doc vis: echo -n "Foo" | sha1sum 14: <<"201a6b3053cc1422d2c3670b62616221d2290929">> = sha:sha1_hex(<<"Foo">>). 15: 16: always_produces_well_formed_output(_) -> 17: prop(always_produces_well_formed_output, 18: ?FORALL(BinaryBlob, binary(), 19: true == is_well_formed(sha:sha1_hex(BinaryBlob)))). 20: 21: is_well_formed(Binary) -> 22: 40 == size(Binary) andalso 23: nomatch == re:run(Binary, "[^0-9a-f]").