{"id":21668480,"url":"https://github.com/macmade/swiftsrp","last_synced_at":"2026-01-27T09:17:53.065Z","repository":{"id":263252386,"uuid":"888093862","full_name":"macmade/SwiftSRP","owner":"macmade","description":"Implementation of the Secure Remote Password protocol (SRP) - RFC 5054 for Swift","archived":false,"fork":false,"pushed_at":"2024-11-17T09:43:57.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T07:52:58.407Z","etag":null,"topics":["authentication","openssl","rfc-5054","secure-remote-password","srp","srp-6a","ssl","swift"],"latest_commit_sha":null,"homepage":"","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/macmade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"macmade"}},"created_at":"2024-11-13T20:01:03.000Z","updated_at":"2024-11-17T17:46:47.000Z","dependencies_parsed_at":"2024-11-17T10:29:52.588Z","dependency_job_id":"4035c99b-ebc0-442c-bf28-0f25d1dd5209","html_url":"https://github.com/macmade/SwiftSRP","commit_stats":null,"previous_names":["macmade/swiftsrp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macmade%2FSwiftSRP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macmade%2FSwiftSRP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macmade%2FSwiftSRP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macmade%2FSwiftSRP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macmade","download_url":"https://codeload.github.com/macmade/SwiftSRP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253025337,"owners_count":21842409,"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":["authentication","openssl","rfc-5054","secure-remote-password","srp","srp-6a","ssl","swift"],"created_at":"2024-11-25T12:16:03.372Z","updated_at":"2026-01-27T09:17:53.028Z","avatar_url":"https://github.com/macmade.png","language":"Swift","funding_links":["https://github.com/sponsors/macmade"],"categories":[],"sub_categories":[],"readme":"SwiftSRP\n========\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/macmade/SwiftSRP/ci-mac.yaml?label=macOS\u0026logo=apple)](https://github.com/macmade/SwiftSRP/actions/workflows/ci-mac.yaml)\n[![Issues](http://img.shields.io/github/issues/macmade/SwiftSRP.svg?logo=github)](https://github.com/macmade/SwiftSRP/issues)\n![Status](https://img.shields.io/badge/status-active-brightgreen.svg?logo=git)\n![License](https://img.shields.io/badge/license-mit-brightgreen.svg?logo=open-source-initiative)  \n[![Contact](https://img.shields.io/badge/follow-@macmade-blue.svg?logo=twitter\u0026style=social)](https://twitter.com/macmade)\n[![Sponsor](https://img.shields.io/badge/sponsor-macmade-pink.svg?logo=github-sponsors\u0026style=social)](https://github.com/sponsors/macmade)\n\n### About\n\nImplementation of the Secure Remote Password protocol (SRP) - RFC 5054 for Swift.\n\n**Supported Hash Algorithms:**\n\n - SHA-1\n - SHA-224\n - SHA-256\n - SHA-384\n - SHA-512\n\n**Supported Group Parameters:**\n\n - 1024 bits\n - 1536 bits\n - 2048 bits\n - 3072 bits\n - 4096 bits\n - 6144 bits\n - 8192 bits\n\n### Example Usage\n\n```swift\n\nimport Foundation\nimport SwiftSRP\n\n// Server storage\nvar salt:     Data!\nvar verifier: Data!\n\n/* Registration */\n// Create a SRP client for an identity, with a given hash algorithm and group type\nlet client = SRPClient( identity: account.identity, hashAlgorithm: .SHA256, groupType: .NG2048 )\n\n// User registers with a password\nclient.setPassword( string: account.password )\n\n// Client generates a salt\nclient.salt = SRPRandom.bytes( count: 16 )\n\n// Client -\u003e Server:\n// Server receives salt and verifier from Client\n// Client can then discard them\nsalt     = client.salt\nverifier = client.v.bytes( endianness: .bigEndian )\n\n/* Authentication */\nlet client = SRPClient( identity: account.identity, hashAlgorithm: .SHA256, groupType: .NG2048 )\nlet server = SRPServer( identity: account.identity, hashAlgorithm: .SHA256, groupType: .NG2048 )\n\n// Server has stored salt and verifier during registration (see above)\nserver.v    = SRPBigNum( data: verifier, endianness: .bigEndian )\nserver.salt = salt\n\n// Client -\u003e Server:\n// Server receives A from Client\nserver.A = client.A\n\n// Server -\u003e Client:\n// Client receives B and salt from Server\nclient.B    = server.B\nclient.salt = server.salt\n\n// User inputs a wrong password\nclient.setPassword( string: \"salad\" )\n\n// Client and Server will not have matching M1 and M2, meaning the authentication failed\nAssertFalse( client.M1 == server.M1 )\nAssertFalse( client.M2 == server.M2 )\n\n// User inputs the correct password\nclient.setPassword( string: account.password )\n\n// With the correct password, Client and Server will have matching M1 and M2, meaning the authentication was successful\nAssertTrue( client.M1 == server.M1 )\nAssertTrue( client.M2 == server.M2 )\n\n```\n\nRequirements\n------------\n\nThis project requires OpenSSL.  \nA pre-built version of BoringSSL is provided for macOS in the `Submodules/SRPXX/Submodules/BoringSSL/lib` directory.\n\nLicense\n-------\n\nProject is released under the terms of the MIT License.\n\nRepository Infos\n----------------\n\n    Owner:          Jean-David Gadina - XS-Labs\n    Web:            www.xs-labs.com\n    Blog:           www.noxeos.com\n    Twitter:        @macmade\n    GitHub:         github.com/macmade\n    LinkedIn:       ch.linkedin.com/in/macmade/\n    StackOverflow:  stackoverflow.com/users/182676/macmade\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacmade%2Fswiftsrp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacmade%2Fswiftsrp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacmade%2Fswiftsrp/lists"}