{"id":34124108,"url":"https://github.com/leo60081/gostructcrypto","last_synced_at":"2026-06-04T11:31:49.769Z","repository":{"id":241242884,"uuid":"180258900","full_name":"leo60081/gostructcrypto","owner":"leo60081","description":"一個簡單使用 防呆的結構加密套件","archived":false,"fork":false,"pushed_at":"2020-06-18T16:50:58.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-17T09:15:53.240Z","etag":null,"topics":["aes","base64","cbc","crypto","ecb","encode","foolproof","golang","structure"],"latest_commit_sha":null,"homepage":"","language":"Go","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/leo60081.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-04-09T01:14:26.000Z","updated_at":"2020-06-18T16:51:01.000Z","dependencies_parsed_at":"2024-05-23T05:09:36.125Z","dependency_job_id":"9c416207-9761-4902-9829-ab6c1ff2ed93","html_url":"https://github.com/leo60081/gostructcrypto","commit_stats":null,"previous_names":["leo60081/gostructcrypto"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leo60081/gostructcrypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leo60081%2Fgostructcrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leo60081%2Fgostructcrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leo60081%2Fgostructcrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leo60081%2Fgostructcrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leo60081","download_url":"https://codeload.github.com/leo60081/gostructcrypto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leo60081%2Fgostructcrypto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33903134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["aes","base64","cbc","crypto","ecb","encode","foolproof","golang","structure"],"created_at":"2025-12-14T22:59:10.981Z","updated_at":"2026-06-04T11:31:49.754Z","avatar_url":"https://github.com/leo60081.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoStructCrypto\n\n### 一個簡單使用 防呆的結構加密套件\n\n## 特性\n1. 使用簡單\n2. AES ECB (預設) AES CBC \n3. Base64 編碼 (預設)\n4. 支援自定義加密 （對稱式加密算法）\n5. 支援自訂義編碼方法\n6. 加密結構宣告維護簡易\n7. 防呆設計 避免加解密次數不對等 導致的資料錯誤\n\n## 簡易範例：\n```\npackage main\n\nimport (\n    \"fmt\"\n\t\"encoding/json\"\t\n\t\"github.com/leo60081/gostructcrypto\"\n)\n\ntype person struct {\n\tID                  int\n\tName                string\n\tPassword            string   `crypto:\"required\"`\n\tAddr                string   `crypto:\"required\" encode:\"required\"`\n\tgostructcrypto.Crypto `-`\n}\n\nfunc main(){\n\tsample := \u0026person{\n\t\tID:       1234567890,\n\t\tName:     \"LeoChen\",\n\t\tPassword: \"112233445566\",\n\t\tAddr:     \"100台北市中正區重慶南路一段122號\",\n\t}\n\t\n\tgostructcrypto.SetGlobalKey(\"Happy_gostructcrypto\")\n\tgostructcrypto.EnCryptoStruct(sample)\n\tb, _ := json.Marshal(sample)\n\tfmt.Printf(\"Plaintext: %+v\\n\", string(b))\n\n\tgostructcrypto.DecryptoStruct(sample)\n\tb, _ = json.Marshal(sample)\n\tfmt.Printf(\"Ciphertext: %+v\\n\", string(b))\n}\n```\n\n## 進階範例：\n```\npackage main\n\nimport (\n    \"fmt\"\n\t\"encoding/json\"\t\n\t\"github.com/leo60081/gostructcrypto\"\n)\n\ntype person struct {\n\tID                    int\n\tName                  string\n\tPassword              string    `crypto:\"required\"`\n\tAddr                  string    `crypto:\"required\" encode:\"required\"`\n\tTags                  *[]string `crypto:\"required\" encode:\"required\"`\n\tHabbits               *habit\n\tgostructcrypto.Crypto `-`\n}\n\ntype habit struct {\n\tItems                 []string `crypto:\"required\" encode:\"required\"`\n\tgostructcrypto.Crypto `-`\n}\n\nfunc main() {\n\tsample := \u0026person{\n\t\tID:       1234567890,\n\t\tName:     \"LeoChen\",\n\t\tPassword: \"112233445566\",\n\t\tAddr:     \"100台北市中正區重慶南路一段122號\",\n\t\tTags: func() *[]string {\n\t\t\ts := []string{\"abc\", \"efg\", \"hij\"}\n\t\t\treturn \u0026s\n\t\t}(),\n\t\tHabbits: \u0026habit{\n\t\t\tItems: []string{\"coding\", \"golang\", \"sleeping\"},\n\t\t},\n\t}\n\n\tsample.SetKey([]byte(\"Happy_gostructcrypto\"))\n\tsample.Habbits.SetKey([]byte(\"qWrsXdRTb2WE$etpdlsDFTR2#!QA;?de\"))\n\tcbc := aes.NewAseCBC([]byte(\"plqawskiedcvfgbr\"))\n\tsample.Habbits.SetEnCryptoFunc(cbc.Encrypt)\n\tsample.Habbits.SetDeCryptoFunc(cbc.Decrypt)\n\n\tgostructcrypto.EnCryptoStruct(sample)\n\tb, _ := json.Marshal(sample)\n\tfmt.Printf(\"Plaintext: %+v\\n\", string(b))\n\n\tgostructcrypto.DecryptoStruct(sample)\n\tb, _ = json.Marshal(sample)\n\tfmt.Printf(\"Ciphertext: %+v\\n\", string(b))\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleo60081%2Fgostructcrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleo60081%2Fgostructcrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleo60081%2Fgostructcrypto/lists"}