{"id":15059617,"url":"https://github.com/tsfoster/elm-sha1","last_synced_at":"2025-07-10T20:31:26.560Z","repository":{"id":57674715,"uuid":"147500328","full_name":"TSFoster/elm-sha1","owner":"TSFoster","description":"Calculate SHA-1 digests in Elm","archived":false,"fork":false,"pushed_at":"2020-06-21T09:13:37.000Z","size":1041,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T17:11:15.687Z","etag":null,"topics":["elm","elm-lang","elmlang","sha","sha-1","sha1"],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/TSFoster/elm-sha1/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TSFoster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-05T10:24:13.000Z","updated_at":"2021-12-14T11:21:16.000Z","dependencies_parsed_at":"2022-09-14T17:20:46.850Z","dependency_job_id":null,"html_url":"https://github.com/TSFoster/elm-sha1","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/TSFoster/elm-sha1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-sha1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-sha1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-sha1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-sha1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TSFoster","download_url":"https://codeload.github.com/TSFoster/elm-sha1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TSFoster%2Felm-sha1/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264652672,"owners_count":23644306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm","elm-lang","elmlang","sha","sha-1","sha1"],"created_at":"2024-09-24T22:46:01.064Z","updated_at":"2025-07-10T20:31:26.194Z","avatar_url":"https://github.com/TSFoster.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SHA1\n\nCalculate SHA-1 digests in Elm.\n\nThis package supports hashing of:\n\n* `String` using the utf-8 encoding\n* `Bytes`, an [`elm/bytes`][elm/bytes] sequence of byte values\n* `List Int` where the elements are assumed to be below 256\n\nAnd can represent the digest as:\n\n* a [hexadecimal] string\n* a [base64] string\n* `Bytes`\n* a `List Int` of byte values\n\n[hexadecimal]: https://en.wikipedia.org/wiki/Hexadecimal\n[base64]: https://en.wikipedia.org/wiki/Base64\n\n# [Documentation](https://package.elm-lang.org/packages/TSFoster/elm-sha1/latest/SHA1)\n\n## Release notes\n\n**Upgrading from `1.0.0 \u003c= v \u003c 1.0.4` is *strongly* recommended.** Later\nversions are more rigiorously tested, are significantly more performant, contain\nbug fixes, and work with elm v0.19.1.\n\n* `2.0.0` prioritises use of [`Bytes`][elm/bytes] over [`List Int`].\n* `1.1.0` introduces the option to hash `Bytes` and represent `Digest`s as `Bytes`, without breaking the API.\n* `1.0.5` provides the performance improvements of the hashing algorithm in a non-breaking manner.\n\nPlease see the [Contributors](#Contributors) section for thanks and more information.\n\n## Examples\n\n```elm\nimport Bytes.Encode as Encode\nimport Bytes exposing (Bytes)\nimport SHA1\n\ndigest1 : SHA1.Digest\ndigest1 = SHA1.fromString \"string\"\n\nbyteValues : List Int\nbyteValues = [0x00, 0xFF, 0xCE, 0x35, 0x74]\n\ndigest2 : SHA1.Digest\ndigest2 = SHA1.fromByteValues byteValues\n\nbuffer : Bytes\nbuffer =\n    List.map Encode.unsignedInt8 byteValues\n        |\u003e Encode.sequence\n        |\u003e Encode.encode\n\ndigest3 : SHA1.Digest\ndigest3 = SHA1.fromBytes buffer\n\nSHA1.toHex digest1\n--\u003e \"ecb252044b5ea0f679ee78ec1a12904739e2904d\"\n\nSHA1.toBase64 digest2\n--\u003e \"gHweOF5Lyg+Ha7ujrlYwNa/Hwgk=\"\n\nSHA1.toByteValues digest3\n--\u003e [ 0x80, 0x7C, 0x1E, 0x38\n--\u003e , 0x5E, 0x4B, 0xCA, 0x0F\n--\u003e , 0x87, 0x6B, 0xBB, 0xA3\n--\u003e , 0xAE, 0x56, 0x30, 0x35\n--\u003e , 0xAF, 0xC7, 0xC2, 0x09\n--\u003e ]\n```\n\n## Validation\n\nNot officially validated through [CAVP]/[CMVP], although digests are tested against CAVS responses via [pyca/cryptography].\n\nValidation tests can be run by executing `make cavs`. This requires make, curl, elm, elm-test and gawk. Alternatively, to run all tests, execute `make test` (which also requires elm-format and elm-verify-examples). See the [`Makefile`](./Makefile) for details.\n\nThis package is also tested against additional hashes in the documentation (using [elm-verify-examples]), [tests/Tests.elm], and indirectly via [romariolopezc/elm-hmac-sha1’s tests][hmac-tests], and [TSFoster/elm-uuid’s tests][uuid-tests].\n\nPlease note that SHA-1 is not “[considered secure against well-funded opponents][sha1-wiki]”, but it does have its uses, including, but not limited to, [version 5 UUIDs][uuid-use].\n\n[CAVP]: https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program\n[CMVP]: https://csrc.nist.gov/projects/cryptographic-module-validation-program\n[pyca/cryptography]: https://github.com/pyca/cryptography/tree/master/vectors/cryptography_vectors/hashes/SHA1\n\n[elm-verify-examples]: https://github.com/stoeffel/elm-verify-examples\n[tests/Tests.elm]: https://github.com/TSFoster/elm-sha1/blob/master/tests/Tests.elm\n[hmac-tests]: https://github.com/romariolopezc/elm-hmac-sha1/blob/master/tests/HmacSha1Test.elm\n[uuid-tests]: https://github.com/TSFoster/elm-uuid/blob/2.2.0/tests/Tests.elm\n\n[sha1-wiki]: https://en.wikipedia.org/wiki/SHA-1\n[uuid-use]: https://package.elm-lang.org/packages/TSFoster/elm-uuid/latest/UUID#childNamed\n\n\n\n## Contributors\n\nSpecial thanks to [Folkert de Vries](https://github.com/folkertdev)\nfor a major rewrite of this library, including huge [performance][perf-1] [gains][perf-2],\nmore [rigorous testing], and support for [elm/bytes].\nMore information can be found on [this Elm Discourse thread][bytes-thread].\n\n[perf-1]: https://github.com/TSFoster/elm-sha1/pull/7\n[perf-2]: https://github.com/TSFoster/elm-sha1/pull/8\n[rigorous testing]: https://github.com/TSFoster/elm-sha1/pull/6\n[bytes-thread]: https://discourse.elm-lang.org/t/fast-pure-elm-sha2-and-soon-sha1/4505\n\n* Thanks to [Colin T.A. Gray](https://github.com/colinta) for finding and [fixing a bug] related to inputs of 311 bytes\n* Thanks to [Dimitri Benin](https://github.com/BendingBender) for making this package [work with elm v0.19.1]\n\n[fixing a bug]: https://github.com/TSFoster/elm-sha1/pull/3\n[work with elm v0.19.1]: https://github.com/TSFoster/elm-sha1/pull/4\n\n\n[elm/bytes]: https://package.elm-lang.org/packages/elm/bytes/latest/\n\n## TODO\n\n* Benchmarks\n  * Add way to run benchmarks\n  * Automate testing that changes do not negatively impact performance?\n* Write CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsfoster%2Felm-sha1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsfoster%2Felm-sha1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsfoster%2Felm-sha1/lists"}