{"id":21373896,"url":"https://github.com/itenfay/DYFCryptoUtils","last_synced_at":"2025-07-13T08:31:18.452Z","repository":{"id":56908114,"uuid":"185082684","full_name":"itenfay/DYFCryptoUtils","owner":"itenfay","description":"实现 iOS 的Base64, 32/16位 MD5, DES, AES, RSA算法，调用简单且好用。(Achieves Base64, 32/16 bit MD5, DES, AES and RSA algorithms for iOS, the invocation is simple and easy to use.)","archived":false,"fork":false,"pushed_at":"2024-06-16T09:32:55.000Z","size":7660,"stargazers_count":10,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-13T07:39:46.689Z","etag":null,"topics":["aes","algorithm","base64","cocoapods","des","ios","objective-c","rsa","rsa-algorithms"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itenfay.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":"2019-05-05T21:09:59.000Z","updated_at":"2024-08-21T01:51:28.000Z","dependencies_parsed_at":"2022-08-21T03:50:15.388Z","dependency_job_id":"b1f2f566-4643-4a16-8199-29ccddb367ac","html_url":"https://github.com/itenfay/DYFCryptoUtils","commit_stats":null,"previous_names":["dgynfi/dyfcryptoutils","itenfay/dyfcryptoutils"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/itenfay/DYFCryptoUtils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFCryptoUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFCryptoUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFCryptoUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFCryptoUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itenfay","download_url":"https://codeload.github.com/itenfay/DYFCryptoUtils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFCryptoUtils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265109709,"owners_count":23712742,"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":["aes","algorithm","base64","cocoapods","des","ios","objective-c","rsa","rsa-algorithms"],"created_at":"2024-11-22T08:29:34.749Z","updated_at":"2025-07-13T08:31:18.406Z","avatar_url":"https://github.com/itenfay.png","language":"Objective-C","readme":"\u003cdiv align=center\u003e\n\u003cimg src=\"https://github.com/itenfay/DYFCryptoUtils/raw/master/images/CryptoUtils.jpg\" width=\"50%\"\u003e\n\u003c/div\u003e\n\n如果能帮助到你，请给[一颗星](https://github.com/itenfay/DYFCryptoUtils)，谢谢！(If you think this can help you, please give it a [star](https://github.com/itenfay/DYFCryptoUtils), Thanks!)\n\n## DYFCryptoUtils\n\n实现 iOS 的`Base64, 32/16位 MD5, DES, AES, RSA`算法，调用简单且好用。(Achieves `Base64, 32/16 bit MD5, DES, AES and RSA` algorithms for iOS, the invocation is simple and easy to use.)\n\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](LICENSE)\u0026nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/v/DYFCryptoUtils.svg?style=flat)](http://cocoapods.org/pods/DYFCryptoUtils)\u0026nbsp;\n![CocoaPods](http://img.shields.io/cocoapods/p/DYFCryptoUtils.svg?style=flat)\u0026nbsp;\n\n## Group (ID:614799921)\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/DYFCryptoUtils/raw/master/images/g614799921.jpg\" width=\"30%\" /\u003e\n\u003c/div\u003e\n\n## Installation\n\nUsing [CocoaPods](https://cocoapods.org):\n\n```\n pod 'DYFCryptoUtils'\n```\n\nOr\n\n```\n pod 'DYFCryptoUtils', '~\u003e 1.1.1'\n```\n\n## Preview\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/DYFCryptoUtils/raw/master/images/CryptoUtilsPreview.gif\" width=\"30%\" /\u003e\n\u003c/div\u003e\n\n## Usage\n\n1. 原文\n\n```\n#define PlainText @\"Objective-C，通常写作ObjC或OC和较少用的Objective C或Obj-C，是扩充C的面向对象编程语言。它主要使用于Mac OS X和GNUstep这两个使用OpenStep标准的系统，而在NeXTSTEP和OpenStep中它更是基本语言。GCC与Clang含Objective-C的编译器，Objective-C可以在GCC以及Clang运作的系统上编译。Swift是苹果于2014年WWDC（苹果开发者大会）发布的一种新的编程语言，用于编写 iOS 和 macOS 应用。Swift 结合了 C 和 Objective-C 的优点并且不受C兼容性的限制。Swift 采用安全的编程模式并添加了很多新特性，这将使编程更简单，更灵活，也更有趣。Swift 是基于成熟而且倍受喜爱的 Cocoa 和 Cocoa Touch 框架，他的降临将重新定义软件开发。\"\n```\n\n2. Base64\n\n```ObjC\n- (IBAction)testBase64:(id)sender {\n    NSString *encodedText = [DYFCryptoUtils base64EncodedString:PlainText];\n    NSLog(@\"[Base64] Encoded text: %@\", encodedText);\n\n    NSString *decodedText = [DYFCryptoUtils base64DecodedString:encodedText];\n    NSLog(@\"[Base64] Decoded text: %@\", decodedText);\n\n    NSData *encodedData = [DYFCryptoUtils base64EncodedDataWithString:PlainText];\n    NSLog(@\"[Base64] Encoded data: %@\", encodedData);\n\n    NSData *decodeData = [DYFCryptoUtils base64DecodedData:encodedData];\n    NSLog(@\"[Base64] Decoded data: %@\", decodeData);\n}\n```\n\n3. MD5\n\n```ObjC\n- (IBAction)testMD5:(id)sender {\n    NSString *hash = [DYFCryptoUtils MD5EncodedString:PlainText];\n    NSLog(@\"[MD5] Hash: %@\", hash);\n\n    NSString *bit16Hash = [DYFCryptoUtils bit16MD5EncodedString:PlainText];\n    NSLog(@\"[MD5] 16 Bit Hash: %@\", bit16Hash);\n}\n```\n\n4. DES\n\n```ObjC\n- (IBAction)testDES:(id)sender {\n    NSString *key = @\"aT59qMrbqJh3o7F566GpO6BhKgdrHDUsMfIPs27J5CmE6DXGkl9VFYam4gRI5MFVjFTi9oScQALesTaPuQ8hdAH9jEssJnItgYxE6Pl+D8sFTVZJvhMwNQR\";\n\n    NSString *encryptedText = [DYFCryptoUtils DESEncrypt:PlainText key:key]; // iv is nil.\n    NSLog(@\"[DES] Encrypted text: %@\", encryptedText);\n\n    NSString *decryptedText = [DYFCryptoUtils DESDecrypt:encryptedText key:key]; // iv is nil.\n    NSLog(@\"[DES] Decrypted text: %@\", decryptedText);\n}\n```\n\n5. AES\n\n```ObjC\n- (IBAction)testAES:(id)sender {\n    NSString *key = @\"aT59qMrbqJh3o7F566GpO6BhKgdrHDUsMfIPs27J5CmE6DXGkl9VFYam4gRI5MFVjFTi9oScQALesTaPuQ8hdAH9jEssJnItgYxE6Pl+D8sFTVZJvhMwNQR\";\n\n    NSString *encryptedText = [DYFCryptoUtils AESEncrypt:PlainText key:key]; // iv is nil.\n    NSLog(@\"[AES] Encrypted text: %@\", encryptedText);\n\n    NSString *decryptedText = [DYFCryptoUtils AESDecrypt:encryptedText key:key]; // iv is nil.\n    NSLog(@\"[AES] Decrypted text: %@\", decryptedText);\n}\n```\n\n6. RSA\n\n- KeyPair: Public Key/Private Key.\n\n```\n// RSA公钥\nstatic NSString *rsaPubKey = @\"MIGfMA0GCSqGSIb3DQEBA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==\";\n```\n\n- Encrypt/Decrypt/Sign/Verify\n\n```ObjC\n- (IBAction)testRSA:(id)sender {\n    NSString *encryptedText = [DYFCryptoUtils RSAEncrypt:PlainText publicKey:rsaPubKey];\n    NSLog(@\"[RSA] Encrypted text: %@\", encryptedText);\n\n    NSString *decryptedText = [DYFCryptoUtils RSADecrypt:encryptedText privateKey:rsaPrivKey];\n    NSLog(@\"[RSA] Decrypted text: %@\", decryptedText);\n\n    NSString *signature = [DYFCryptoUtils RSASign:PlainText privateKey:rsaPrivKey];\n    NSLog(@\"[RSA] Signature: %@\", signature);\n\n    BOOL re = [DYFCryptoUtils RSAVerify:PlainText signature:signature publicKey:rsaPubKey];\n    NSLog(@\"[RSA] Signature verificaiton: %@\", re ? @\"Success\" : @\"Failure\");\n}\n```\n\n## Sample\n\n- [Code Sample Portal](https://github.com/itenfay/DYFCryptoUtils/blob/master/Basic%20Files/ViewController.m)\n","funding_links":[],"categories":["OOM-Leaks-Crash"],"sub_categories":["数据安全和算法"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2FDYFCryptoUtils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitenfay%2FDYFCryptoUtils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2FDYFCryptoUtils/lists"}