{"id":21921238,"url":"https://github.com/alexaubry/Crypto","last_synced_at":"2025-07-21T20:31:09.178Z","repository":{"id":127268054,"uuid":"110080462","full_name":"alexaubry/Crypto","owner":"alexaubry","description":"Swift wrapper for CommonCrypto","archived":false,"fork":false,"pushed_at":"2017-11-12T18:04:58.000Z","size":98,"stargazers_count":4,"open_issues_count":3,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T11:06:36.502Z","etag":null,"topics":["commoncrypto","cryptography","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexaubry.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-09T07:11:51.000Z","updated_at":"2025-05-20T09:46:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"ead62608-1851-4de4-9983-48e4e57e2ed6","html_url":"https://github.com/alexaubry/Crypto","commit_stats":null,"previous_names":["alexaubry/crypto"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexaubry/Crypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexaubry%2FCrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexaubry%2FCrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexaubry%2FCrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexaubry%2FCrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexaubry","download_url":"https://codeload.github.com/alexaubry/Crypto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexaubry%2FCrypto/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266375061,"owners_count":23919512,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["commoncrypto","cryptography","swift"],"created_at":"2024-11-28T20:20:00.733Z","updated_at":"2025-07-21T20:31:09.171Z","avatar_url":"https://github.com/alexaubry.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crypto\n\nCrypto is an easy-to-use and type safe Swift wrapper for CommonCrypto.\n\n## Requirements\n\n- iOS 8 and later\n- macOS 10.10 and later\n- tvOS 9.0 and later\n- watchOS 2.0 and later\n- Swift 3.2 and later\n\n## Installation\n\nCrypto is available via Carthage.\n\n### Carthage\n\nTo install Crypto using [Carthage](https://github.com/Carthage/Carthage), add this line to your `Cartfile`:\n\n~~~\ngithub \"alexaubry/Crypto\"\n~~~\n\n### CocoaPods\n\nCrypto cannot be installed with Carthage yet. Please read [#1](https://github.com/alexaubry/Crypto/issues/1) for more information.\n\n## Usage\n\nCrypto supports the following operations:\n\n- [Digests](#digests)\n- [HMAC](#hmac)\n- [Key Derivation - PBKDF2](#key-derivation)\n- [Symmetric Key Wrap](#key-wrap)\n- [Encryption / Decryption](#encryption-and-decryption)\n\n### Digests\n\nUse the `Digest` enum to compute the hash of messages.\n\n~~~swift\nlet message: Data = \"secret\".data(using: .utf8)!\nlet hash = Digest.sha256.hash(message: message)\n~~~\n\nThe `hash(message:)` method returns a `Data` object containing the hash.\n\n\u003e Available digests: `.md4`, `.md5`, `.sha1`, `.sha224`, `.sha256`, `.sha384`, `.sha512`\n\n### HMAC\n\nUse the `HMAC` enum to compute the HMAC for a given message and key.\n\n~~~swift\nlet message: Data = \"secret\".data(using: .utf8)!\nlet key: Data = ...\nlet hmac = HMAC.sha256.authenticate(message: message, with: key)\n~~~\n\nThe `authenticate(message:,with:)` method returns a `Data` object containing the HMAC code for the message.\n\n\u003e Available algorithms: `.sha1`, `.sha224`, `.sha256`, `.sha384`, `.sha512`\n\n## Key Derivation\n\nUse the `KeyDerivation` enum to calibrate and derive passwords with the `PBKDF2` algorithm.\n\n## Key Wrap\n\nUse the `SymmetricKeyWrap` enum to wrap and unwrap keys with an encryption key.\n\n## Encryption and Decryption\n\nUse the `Cryptor` enum to encrypt and decrypt data.\n\n### Random Data\n\nTwo random data generators are available:\n\n- `CommonRandom` - uses `CCRandomGenerateBytes` from CommonCrypto\n- `SecRandom` - uses `SecRandomCopyBytes` from Security.framework\n\nThey both conform to the `Random` protocol.\n\n**Example**:\n\n~~~swift\nlet ccRandom: Data = try CommonRandom.generate(bytes: 32)\nlet secRandom: Data = try SecRandom.generate(bytes: 32)\n~~~\n\nThis generates 32 bytes of random data. \n\n## Author\n\nWritten by Alexis Aubry. You can [find me on Twitter](https://twitter.com/_alexaubry).\n\n## License\n\nCrypto is available under the MIT license. See the [LICENSE](LICENSE) file for more info.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexaubry%2FCrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexaubry%2FCrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexaubry%2FCrypto/lists"}