[
    {
        "name": "Word.Hex",
        "comment": " Convert to and from strings of hexadecimal characters.\n\nExamples assume the following:\n\n    import Array\n    import Word exposing (Size(Bit32), Word(D, W))\n\n\n## From Other to Hex\n\n@docs CharCount, fromInt, fromByte, fromWord, fromByteList, fromWordArray\n\n\n## From Hex to Other\n\n@docs toByteList, toWordArray\n\n",
        "unions": [],
        "aliases": [
            {
                "name": "CharCount",
                "comment": " When converting from integers, the number characters in the hex string.\n",
                "args": [],
                "type": "Int"
            }
        ],
        "values": [
            {
                "name": "fromByte",
                "comment": " Convert a byte to a hex string of length 2.\n\n    fromByte 0x7B\n    --> \"7b\"\n\n",
                "type": "Int -> String"
            },
            {
                "name": "fromByteList",
                "comment": " Convert a list of bytes to a string of hexadecimal characters.\n\n    fromByteList [ 0xde, 0xad, 0xbe, 0xef ]\n    --> \"deadbeef\"\n\n",
                "type": "List Int -> String"
            },
            {
                "name": "fromInt",
                "comment": " Convert an integer to a string of hexadecimal characters.\n\n    fromInt 1 10\n    --> \"a\"\n\n    fromInt 8 0x42BEEF\n    --> \"0042beef\"\n\n",
                "type": "CharCount -> Int -> String"
            },
            {
                "name": "fromWord",
                "comment": " Convert a list of words to a string of hexadecimal characters.\n\n    W 16 |> fromWord\n    --> \"00000010\"\n\n    D 0xDEADBEEF 0x00112233 |> fromWord\n    --> \"deadbeef00112233\"\n\n",
                "type": "Word -> String"
            },
            {
                "name": "fromWordArray",
                "comment": " Convert an array of words to a string of hexadecimal characters.\n\n    Word.fromUTF8 Bit32 \"I ❤ UTF strings!\" |> fromWordArray\n    --> \"4920e29da42055544620737472696e6773210000\"\n\n",
                "type": "Array Word -> String"
            },
            {
                "name": "toByteList",
                "comment": " Convert a string of hexadecimal values to a list of bytes.\n\nFails for non-hex strings.\n\n    toByteList \"not hex\"\n    --> []\n\nEach byte requires 2 characters, so odd length strings fail\n\n    toByteList \"000\"\n    --> []\n\nSome passing examples\n\n    toByteList \"00\"\n    --> [ 0x00 ]\n\n    toByteList \"010203040506DEADbeef\"\n    --> [ 0x01, 0x02, 0x03, 0x04\n    --> , 0x05, 0x06, 0xDE, 0xAD\n    --> , 0xBE, 0xEF\n    --> ]\n\n",
                "type": "String -> List Int"
            },
            {
                "name": "toWordArray",
                "comment": " Convert a string of hexadecimal values to an array of words.\n\n    toWordArray Word.Bit32 \"DEADBEEFdeadbeef\" |> fromWordArray\n    --> \"deadbeefdeadbeef\"\n\n",
                "type": "Size -> String -> Array Word"
            }
        ],
        "binops": []
    },
    {
        "name": "Word",
        "comment": " Unsigned 32 or 64 bit integers and related operations.\n\n\n## Table of Contents\n\n  - [Types](#types)\n  - [Constructors](#constructors)\n  - [Conversions](#conversions)\n  - [Arithmetic](#arithmetic)\n  - [Bitwise](#bitwise)\n  - [Misc](#misc)\n\nThis package was developed to facilitate computations for [SHA-2](https://en.wikipedia.org/wiki/SHA-2).\nIt contains the minimal set of functions required by those algorithms.\n\nExamples below assume the following imports:\n\n    import Array\n    import Word.Hex as Hex\n\n\n## Types\n\n@docs Word, Size\n\n\n## Constructors\n\n@docs fromBytes,fromUTF8, zero\n\n\n## Conversions\n\n@docs toBytes\n\n\n## Arithmetic\n\n@docs add\n\n\n## Bitwise\n\n@docs and, xor, complement, rotateRightBy, shiftRightZfBy\n\n\n## Misc\n\n@docs sizeInBytes\n\n",
        "unions": [
            {
                "name": "Size",
                "comment": " Size of a word.\n",
                "args": [],
                "cases": [
                    [
                        "Bit32",
                        []
                    ],
                    [
                        "Bit64",
                        []
                    ]
                ]
            },
            {
                "name": "Word",
                "comment": " Unsigned integers of size 32 or 64 bits.\n\n  - `W` a \"word\" of size 32 bits\n  - `D` a \"double word\" of size 64 bits\n  - `Mismatch` value of any operation that mixes word types\n\nThese constructors are provided as a convenience, but are unsafe.\nUse `fromBytes` or `fromUTF8` to safely create arrays of words of the same type.\n\n",
                "args": [],
                "cases": [
                    [
                        "W",
                        [
                            "Int"
                        ]
                    ],
                    [
                        "D",
                        [
                            "Int",
                            "Int"
                        ]
                    ],
                    [
                        "Mismatch",
                        []
                    ]
                ]
            }
        ],
        "aliases": [],
        "values": [
            {
                "name": "add",
                "comment": " Modulo adds two words of the same type.\n\n    add (W 0x80000000) (W 0x7FFFFFFF) |> Hex.fromWord\n    --> \"ffffffff\"\n\n    add (W 0x80000000) (W 0x80000003) |> Hex.fromWord\n    --> \"00000003\"\n\n    add (D 0 0xFFFFFFFF) (D 0 1) |> Hex.fromWord\n    --> \"0000000100000000\"\n\n    add (D 0xFFFFFFFF 0xFFFFFFFF) (D 0 2) |> Hex.fromWord\n    --> \"0000000000000001\"\n\n    add (W 0) (D 0 0)\n    --> Mismatch\n\n",
                "type": "Word -> Word -> Word"
            },
            {
                "name": "and",
                "comment": " Bitwise and.\n\n    Word.and\n        (W 0xFF00FF00)\n        (W 0xFFFF0000) |> Hex.fromWord\n    --> \"ff000000\"\n\n    Word.and\n        (D 0xFF00FF00 0xFFFF0000)\n        (D 0xFFFF0000 0xFF00FF00) |> Hex.fromWord\n    --> \"ff000000ff000000\"\n\n",
                "type": "Word -> Word -> Word"
            },
            {
                "name": "complement",
                "comment": " Bitwise complement.\n\n    Word.complement\n        (W 0x00FF00FF) |> Hex.fromWord\n    --> \"ff00ff00\"\n\n    Word.complement\n        (D 0x00FF00FF 0x00FF00FF) |> Hex.fromWord\n    --> \"ff00ff00ff00ff00\"\n\n",
                "type": "Word -> Word"
            },
            {
                "name": "fromBytes",
                "comment": " Convert a list of bytes to an array of words of the given size.\n\n    fromBytes Bit32 [ 0xDE, 0xAD, 0xBE, 0xEF ]\n    --> [ W 0xDEADBEEF ] |> Array.fromList\n\n    fromBytes Bit32\n        [ 0xDE, 0xAD, 0xBE, 0xEF\n        , 0x01, 0x23, 0x45, 0x67\n        ]\n    --> [ W 0xDEADBEEF, W 0x01234567 ] |> Array.fromList\n\n    fromBytes Bit64\n        [ 0xDE, 0xAD, 0xBE, 0xEF\n        , 0x01, 0x23, 0x45, 0x67\n        ]\n    --> [ D 0xDEADBEEF 0x01234567 ] |> Array.fromList\n\n",
                "type": "Size -> List Int -> Array Word"
            },
            {
                "name": "fromUTF8",
                "comment": " Convert a UTF8 string to an array of words of the given size.\n\n    fromUTF8 Bit32 \"I ❤ UTF strings!\" |> Array.toList\n    --> [ W 0x4920E29D  -- 'I', ' ', 226, 157\n    --> , W 0xA4205554  -- 164, ' ', 'U', 'T'\n    --> , W 0x46207374  -- 'F', ' ', 's', 't'\n    --> , W 0x72696E67  -- 'r', 'i', 'n', 'g'\n    --> , W 0x73210000  -- 's', '!'\n    --> ]\n\n    fromUTF8 Bit64 \"I ❤ UTF strings!\" |> Array.toList\n    --> [ D 0x4920E29D 0xA4205554 -- 'I', ' ', 226, 157, 164, ' ', 'U', 'T'\n    --> , D 0x46207374 0x72696E67 -- 'F', ' ', 's', 't', 'r', 'i', 'n', 'g'\n    --> , D 0x73210000 0x00000000 -- 's', '!'\n    --> ]\n\n",
                "type": "Size -> String -> Array Word"
            },
            {
                "name": "rotateRightBy",
                "comment": " Rotate bits to the right by the given offset.\n\n<https://en.wikipedia.org/wiki/Bitwise_operation#Rotate_no_carry>\n\n    rotateRightBy 4 (W 0xDEADBEEF) |> Hex.fromWord\n    --> \"fdeadbee\"\n\n    rotateRightBy 4 (D 0xDDEEAADD 0xBBEEAAFF) |> Hex.fromWord\n    --> \"fddeeaaddbbeeaaf\"\n\n    rotateRightBy 7 Mismatch\n    --> Mismatch\n\n",
                "type": "Int -> Word -> Word"
            },
            {
                "name": "shiftRightZfBy",
                "comment": " Shift bits to the right by a given offset, filling new bits with zeros.\n\n<https://en.wikipedia.org/wiki/Bitwise_operation#Logical_shift>\n\n    shiftRightZfBy 9 (W 0xFFFF) |> Hex.fromWord\n    --> \"0000007f\"\n\n    shiftRightZfBy 32 (W 0xFFFF) |> Hex.fromWord\n    --> \"00000000\"\n\n    shiftRightZfBy 8 (D 0x01234567 0x89abcdef) |> Hex.fromWord\n    --> \"000123456789abcd\"\n\n    shiftRightZfBy 4 Mismatch\n    --> Mismatch\n\n",
                "type": "Int -> Word -> Word"
            },
            {
                "name": "sizeInBytes",
                "comment": " Convert the given word size to a byte count.\n",
                "type": "Size -> Int"
            },
            {
                "name": "toBytes",
                "comment": " Convert an array of words to a list of bytes.\n\n    [ W 0 ] |> Array.fromList |> toBytes\n    --> [ 0, 0, 0, 0 ]\n\n    [ D 0 0 ] |> Array.fromList |> toBytes\n    --> [ 0, 0, 0, 0, 0, 0, 0, 0 ]\n\n    [ W 16843010 ] |> Array.fromList |> toBytes\n    --> [ 1, 1, 1, 2 ]\n\n",
                "type": "Array Word -> List Int"
            },
            {
                "name": "xor",
                "comment": " Bitwise xor.\n\n    Word.xor\n        (W 0xFF00FF00)\n        (W 0x00FFFF00) |> Hex.fromWord\n    --> \"ffff0000\"\n\n    Word.xor\n        (D 0xFF00FF00 0x00FFFF00)\n        (D 0x00FFFF00 0xFF00FF00) |> Hex.fromWord\n    --> \"ffff0000ffff0000\"\n\n",
                "type": "Word -> Word -> Word"
            },
            {
                "name": "zero",
                "comment": " The integer zero as a word of the given size.\n",
                "type": "Size -> Word"
            }
        ],
        "binops": []
    },
    {
        "name": "Word.Bytes",
        "comment": " Helper functions for creating lists of bytes.\n\n    import Word.Hex as Hex\n\n@docs ByteCount, fromInt, fromUTF8\n\n",
        "unions": [],
        "aliases": [
            {
                "name": "ByteCount",
                "comment": " Total number of bytes\n",
                "args": [],
                "type": "Int"
            }
        ],
        "values": [
            {
                "name": "fromInt",
                "comment": " Split an integer value into a list of bytes with the given length.\n\n    fromInt 4 0 |> Hex.fromByteList\n    --> \"00000000\"\n\n    fromInt 4 1 |> Hex.fromByteList\n    --> \"00000001\"\n\n    fromInt 2 2 |> Hex.fromByteList\n    --> \"0002\"\n\n    fromInt 1 255 |> Hex.fromByteList\n    --> \"ff\"\n\n    fromInt 4 256 |> Hex.fromByteList\n    --> \"00000100\"\n\n    fromInt 4 65537 |> Hex.fromByteList\n    --> \"00010001\"\n\n    fromInt 4 16777216 |> Hex.fromByteList\n    --> \"01000000\"\n\n    fromInt 8 344 |> Hex.fromByteList\n    --> \"0000000000000158\"\n\n    fromInt 16 344 |> Hex.fromByteList\n    --> \"00000000000000000000000000000158\"\n\n",
                "type": "ByteCount -> Int -> List Int"
            },
            {
                "name": "fromUTF8",
                "comment": " Convert a character into a list of bytes\n\n    fromUTF8 \"a\" |> Hex.fromByteList\n    --> \"61\"\n\n    fromUTF8 \"I ❤ cheese\"\n    --> [ 73, 32,\n    -->   226, 157, 164,\n    -->   32, 99, 104, 101, 101, 115, 101 ]\n\n    fromUTF8 \"dѐf\"\n    --> [ 100, 209, 144, 102 ]\n\n",
                "type": "String -> List Int"
            }
        ],
        "binops": []
    }
]