{"id":52559,"date":"2024-12-03T15:31:53","date_gmt":"2024-12-03T07:31:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52559\/"},"modified":"2024-12-03T15:31:53","modified_gmt":"2024-12-03T07:31:53","slug":"flutter-%e9%a1%b9%e7%9b%ae%e4%b8%ad%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0-aes-%e5%8a%a0%e5%af%86%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52559\/","title":{"rendered":"Flutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Flutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f<\/h1>\n<p><span style=\"color: #222222;, sans-serif;background-color: #FFFFFF\">\u5404\u4f4d\u5c0f\u4f19\u4f34\u4eec\uff0c\u5927\u5bb6\u597d\u5440\uff01\u770b\u770b\u4eca\u5929\u6211\u53c8\u7ed9\u5404\u4f4d\u5e26\u6765\u4e86\u4ec0\u4e48\u6587\u7ae0\uff1f\u672c\u6587\u6807\u9898<span style=\"color: #222222;, sans-serif;background-color: #FFFFFF\">\u662f<\/span><span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aFlutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f\u300b<\/span>\uff0c\u5f88\u660e\u663e\u662f\u5173\u4e8e<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u7684\u6587\u7ae0\u54c8\u54c8\u54c8\uff0c\u5176\u4e2d\u5185\u5bb9\u4e3b\u8981\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u5982\u679c\u80fd\u5e2e\u5230\u4f60\uff0c\u89c9\u5f97\u5f88\u4e0d\u9519\u7684\u8bdd\uff0c\u6b22\u8fce\u5404\u4f4d\u591a\u591a\u70b9\u8bc4\u548c\u5206\u4eab\uff01<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241121\/1732180173673ef8cd5f9ea.jpg\" class=\"aligncenter\" title=\"Flutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f\u63d2\u56fe\" alt=\"Flutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f\u63d2\u56fe\" \/><\/p>\n<p>\u5982\u4f55\u5728 flutter \u9879\u76ee\u4e2d\u52a0\u5bc6\u5b57\u7b26\u4e32\uff1f<\/p>\n<p>\u5728 flutter \u9879\u76ee\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 encrypt \u5e93\u6765\u5b9e\u73b0 aes \u52a0\u5bc6\uff0c\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>import 'package:encrypt\/encrypt.dart';\n\nclass EncryptHelper {\n  static String encryptAes(String plainText) {\n    const key = 'ihaierForTodoKey';\n    const iv = 'ihaierForTodo_Iv';\n    final _key = Key.fromUtf8(key);\n    final _iv = IV.fromUtf8(iv);\n    final encrypter = Encrypter(AES(_key, mode: AESMode.cbc));\n\n    final encrypted = encrypter.encrypt(plainText, iv: _iv);\n\n    return encrypted.base64;\n  }\n}<\/pre>\n<p>\u672c\u7bc7\u5173\u4e8e\u300aFlutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   Docker MySQL \u5bb9\u5668\u8fde\u63a5\u62a5\u9519\uff1a\u5982\u4f55\u89e3\u51b3 Sequel Ace \u8fde\u63a5\u5931\u8d25\u95ee\u9898\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Flutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f \u5404\u4f4d\u5c0f\u4f19\u4f34\u4eec\uff0c\u5927\u5bb6\u597d\u5440\uff01\u770b\u770b\u4eca\u5929\u6211\u53c8\u7ed9\u5404\u4f4d\u5e26\u6765\u4e86\u4ec0\u4e48\u6587\u7ae0\uff1f\u672c\u6587\u6807\u9898\u662f\u300aFlutter \u9879\u76ee\u4e2d\u5982\u4f55\u5b9e\u73b0 AES \u52a0\u5bc6\uff1f\u300b\uff0c\u5f88\u660e\u663e\u662f\u5173\u4e8e\u6587\u7ae0\u7684\u6587\u7ae0\u54c8\u54c8\u54c8\uff0c\u5176\u4e2d\u5185\u5bb9\u4e3b\u8981\u4f1a\u6d89\u53ca\u5230\u7b49\u7b49\uff0c\u5982\u679c\u80fd\u5e2e\u5230\u4f60\uff0c\u89c9\u5f97\u5f88\u4e0d\u9519\u7684\u8bdd\uff0c\u6b22\u8fce\u5404\u4f4d\u591a\u591a\u70b9\u8bc4\u548c\u5206\u4eab\uff01 \u5982\u4f55\u5728 flutter \u9879\u76ee\u4e2d\u52a0\u5bc6\u5b57\u7b26\u4e32\uff1f \u5728 flutter \u9879\u76ee\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 encrypt \u5e93\u6765\u5b9e\u73b0 aes \u52a0\u5bc6\uff0c\u5177\u4f53\u65b9\u6cd5\u5982\u4e0b\uff1a import &#8216;package:encrypt\/encrypt.dart&#8217;; class EncryptHelper { static String encryptAes(String plainText) { const key = &#8216;ihaierForTodoKey&#8217;; const iv = &#8216;ihaierForTodo_Iv&#8217;; final _key = Key.fromUtf8(key); final _iv = IV.fromUtf8(iv); final encrypter = Encrypter(AES(_key, mode: AESMode.cbc)); final encrypted = encrypter.encrypt(plainText, iv: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-52559","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52559"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52559\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}