Functions to hash values.
List Basics.Int
A list of bytes.
bytes : Objecthash.Value.Value -> ByteList
Hash an Objecthash Value.
bytes VNull == [ 27, 22, 177, 223, 83, 139, 161, 45, 195, 249, 126, 219, 184, 92, 170, 112, 80, 212, 108, 20, 129, 52, 41, 15, 235, 168, 15, 130, 54, 200, 61, 185 ]
toHex : ByteList -> String
Transform a list of bytes into its hexadecimal string representation.
toHex [ 27, 22, 177, 223, 83, 139, 161, 45, 195, 249, 126, 219, 184, 92, 170, 112, 80, 212, 108, 20, 129, 52, 41, 15, 235, 168, 15, 130, 54, 200, 61, 185 ] == "1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9"
unicode : String -> ByteList
Hashes a unicode string.
toHex (unicode "foo") == "a6a6e5e783c363cd95693ec189c2682315d956869397738679b56305f2095038"
redacted : String -> ByteList
Hashes a redacted stringified list of bytes.
toHex (redacted "**REDACTED**480499ec4efe0e177793c217c8227d4096d2352beee2d6816ba8f4e8a421a138") == "480499ec4efe0e177793c217c8227d4096d2352beee2d6816ba8f4e8a421a138"
null : ByteList
Hashes a null value.
toHex null == "1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9"
int : Basics.Int -> ByteList
Hashes an integer.
toHex (int 6) == "396ee89382efc154e95d7875976cce373a797fe93687ca8a27589116644c4bcd"
float : Basics.Float -> ByteList
Hashes a float number. Note this function normalises values following the same algorithm implemented in the original Objecthash implementation.
toHex (float 6.1) == "43f5ebd1617989a69b819ed3a246c9e59468d6db90c29abdd3c8c1f17ffc365a"
bool : Basics.Bool -> ByteList
Hashes a boolean.
toHex (bool True) == "7dc96f776c8423e57a2785489a3f9c43fb6e756876d6ad9a9cac4aa4e72ec193"
raw : String -> ByteList
Hashes a raw hash.
toHex (raw "7dc96f776c8423e57a2785489a3f9c43fb6e756876d6ad9a9cac4aa4e72ec193") == "72e68c48e6e01b3d898bf9d907938459cb80d6abec2078df7f19271ff9eb19e4"
pair : ( String, ByteList ) -> ByteList
list : List ByteList -> ByteList
Hashes a list of ByteList.
[ unicode "foo", int 6 ]
|> list
|> toHex
== "28dbb78890fb7b0462c62de04bcf165c69bd65b9f992f2edd89ae7369afa7005"
set : List ByteList -> ByteList
Hashes a set of ByteList. Note that this function receives a List
but
treats it as a Set (i.e. removes duplicates).
[ unicode "foo", int 6 ]
|> set
|> toHex
== "cf38664185ed5377fee384d0a37bdb36681a16d72480f21336e38a493a8851b9"
dict : Dict String ByteList -> ByteList
Hahes a dictionary of ByteList.
Dict.fromList [ ( "foo", int 1 ) ]
|> dict
|> toHex
== "bf4c58f5e308e31e2cd64bdbf7a01b9b595a13602438be5e912c7d94f6d8177a"
bag : Objecthash.Tag.Tag -> List ByteList -> ByteList
Hashes collections of bytes
untagged : List ByteList -> ByteList
Hashes a raw list of bytes, untagged