SHA-384 is a cryptographic hash function that gives 192 bits of security.
It is a truncated variant of SHA-512 with different initial hash values.
Create a digest from a String.
import SHA384
SHA384.fromString "hello world"
|> SHA384.toHex
--> "fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd"Create a digest from Bytes.
import Bytes.Encode as Encode exposing (Endianness(..))
import SHA384
Encode.unsignedInt32 Encode.BE 42
|> Encode.encode
|> SHA384.fromBytes
|> SHA384.toHex
--> "169c6e0f2a73b8a3f0c6dad952ab62ee64136652d1bfcf5901951186384324070819bba50666c9371265b68b7a57410d"Create a digest from a list of byte values (0-255).
import SHA384
SHA384.fromByteValues [ 72, 105, 33, 32, 240, 159, 152, 132 ]
== SHA384.fromString "Hi! \u{1F604}"
--> TrueTurn a digest into a hex string.
import SHA384
SHA384.fromString "And our friends are all aboard"
|> SHA384.toHex
--> "8b955c0b596df8b93db7c9a0105098c5be18bd4dbbea4cccf9b4b138c54668d0c9295485dc3b20a1ecd1bf97762f3b47"Turn a digest into a base64 encoded string.
import SHA384
SHA384.fromString "Many more of them live next door"
|> SHA384.toBase64
--> "pKq5Z/Msjg14oJ2TGHS21h+L9lMWkASENRmCgur5mpwRNoE3dAPWV6kw+aNX1gmB"Turn a digest into a list of byte values (0-255).
import SHA384
SHA384.fromString "And the band begins to play"
|> SHA384.toByteValues
--> [ 216, 234, 215, 67, 129, 199, 177, 6
--> , 4, 113, 130, 141, 149, 211, 213, 72
--> , 182, 77, 43, 191, 48, 162, 210, 207
--> , 88, 239, 69, 109, 211, 248, 187, 238
--> , 97, 27, 125, 162, 116, 132, 44, 35
--> , 116, 33, 51, 81, 115, 241, 201, 137
--> ]
An abstract sha384 digest.