arrow-refined-types / arrow.refinement.digests / SHA384

SHA384

class SHA384

SHA384 constrains String to be a valid hexadecimal String of length 96

Safe nullable construction

import arrow.refinement.digests.SHA384

SHA384.orNull("768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9")
SHA384.orNull("not-sha384")

Resolved constraints

SHA384.constraints("768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9")
SHA384.constraints("not-sha384")
SHA384.isValid("768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9")
SHA384.isValid("not-sha384")

Folding validation

SHA384.fold("768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9", { "failed: $it" }, { "success: $it" })
SHA384.fold("not-sha384", { "failed: $it" }, { "success: $it" })

Unsafe require

SHA384.require("768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9")
try { SHA384.require("not-sha384") } catch (e: IllegalArgumentException) { e.message }

Types

Companion companion object Companion : Refined<String, SHA384>

Properties

value val value: String

Do you like Arrow?

Arrow Org
<