{"id":20081563,"url":"https://github.com/hexpm/pbcs","last_synced_at":"2025-05-06T00:31:19.794Z","repository":{"id":50151671,"uuid":"144485838","full_name":"hexpm/pbcs","owner":"hexpm","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-28T17:53:16.000Z","size":61,"stargazers_count":20,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-30T23:47:53.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexpm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-08-12T17:11:46.000Z","updated_at":"2024-02-06T18:37:33.000Z","dependencies_parsed_at":"2022-09-07T05:51:22.546Z","dependency_job_id":null,"html_url":"https://github.com/hexpm/pbcs","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexpm%2Fpbcs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexpm%2Fpbcs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexpm%2Fpbcs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexpm%2Fpbcs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexpm","download_url":"https://codeload.github.com/hexpm/pbcs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252598283,"owners_count":21774232,"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":[],"created_at":"2024-11-13T15:39:29.313Z","updated_at":"2025-05-06T00:31:19.525Z","avatar_url":"https://github.com/hexpm.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PBCS\n\n[![Hex version](https://img.shields.io/hexpm/v/pbcs.svg \"Hex version\")](https://hex.pm/packages/pbcs)\n[![CI](https://github.com/hexpm/hexpm/workflows/CI/badge.svg)](https://github.com/hexpm/pbcs/actions?query=workflow%3ACI)\n\nThe PBCS library securely protects secrets using passwords by following the\nstyle and recommendations in [PKCS #5 2.1](https://tools.ietf.org/html/rfc8018).\nAs in PKCS #5, this library uses a salt to protect against dictionary attacks\nand iterates the key derivation function to increase the computation cost of\nattacks. These parameters and the cryptographic algorithms used are\nconfigurable.\n\nKey derivation algorithms include:\n\n* `PBES2-HS512`, `PBES2-HS384`, `PBES2-HS256` - PBES2 and HMAC-SHA-2. See [RFC 7518 4.8](https://tools.ietf.org/html/rfc7518#section-4.8) and [RFC 2898 6.2](https://tools.ietf.org/html/rfc2898#section-6.2)\n\nContent encryption algorithms include:\n\n* `A256GCM`, `A192GCM`, `A128GCM` - AES GCM. See [RFC 7518 5.3](https://tools.ietf.org/html/rfc7518#section-5.3)\n* `A256CBC-HS512`, `A192CBC-HS384`, `A128CBC-HS256` - AES_CBC_HMAC_SHA2. See [RFC 7518 5.2.6](https://tools.ietf.org/html/rfc7518#section-5.2.6)\n\n## Installation\n\nAdd pbcs to the `deps` section of your mix.exs file:\n\n```elixir\ndef deps do\n  [\n    {:pbcs, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\n```elixir\nprotected = %{\n  alg: \"PBES2-HS512\",\n  enc: \"A256GCM\",\n  p2c: 4096,\n  p2s: :crypto.strong_rand_bytes(32)\n}\n\ntag = \"ARBITRARY_TAG\"\n\ncipher_text = PBCS.encrypt({tag, \"Text to encrypt\"}, protected, password: \"12345\")\n{:ok, \"Text to encrypt\"} = PBCS.decrypt({tag, cipher_text}, password: \"12345\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexpm%2Fpbcs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexpm%2Fpbcs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexpm%2Fpbcs/lists"}