{"id":42202693,"url":"https://github.com/keepchen/toolkit","last_synced_at":"2026-01-27T00:28:18.494Z","repository":{"id":57543832,"uuid":"295676949","full_name":"keepchen/toolkit","owner":"keepchen","description":"toolkit written in Go","archived":false,"fork":false,"pushed_at":"2021-04-08T09:58:08.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T09:14:59.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/keepchen.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}},"created_at":"2020-09-15T09:21:24.000Z","updated_at":"2021-04-08T09:58:11.000Z","dependencies_parsed_at":"2022-08-27T18:51:52.279Z","dependency_job_id":null,"html_url":"https://github.com/keepchen/toolkit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/keepchen/toolkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keepchen%2Ftoolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keepchen%2Ftoolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keepchen%2Ftoolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keepchen%2Ftoolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keepchen","download_url":"https://codeload.github.com/keepchen/toolkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keepchen%2Ftoolkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28793132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-27T00:28:18.411Z","updated_at":"2026-01-27T00:28:18.476Z","avatar_url":"https://github.com/keepchen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# toolkit\n\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/keepchen/toolkit?tab=overview)\n\n#### 简介\n\n封装了一些常用的工具包，逐步更新\n\n#### 安装\n\n```shell\ngo get github.com/keepchen/toolkit\n```\n\n#### 方法\n\n* 初始化\n\n```golang\nimport \"github.com/keepchen/toolkit\"\n\nkit := toolkit.NewToolkit()\n```\n\n---\n字符串\n\n---\n\n* 生成短信验证码\n\n```golang\nsmsCode := kit.GenerateSMSCode(5)\n```\n\n* 生成随机字符串\n\n```golang\nshuffleStr := kit.GenerateRandomString(5)\n```\n\n* 验证手机号码\n\n```golang\nok := kit.ValidatePhone(\"13890012345\")\n```\n\n---\n文件\n\n---\n\n* 解压zip文件\n\n```golang\nfileList, err := kit.Unzip(\"xx.zip\", \"/data/\")\n```\n\n---\n加密\n\n---\n\n* MD5加密\n\n```golang\nhashedStr := kit.MD5encode(\"123\")\n```\n\n* sha256-rsa\n\n```golang\nc := kit.SetPublicKey(pubKey).SetPrivateKey(privateKey)\n//or\n//c := kit.SetKey(pubKey, privateKey)\n\n//签名\nsign, err := c.SignUsingSha256WithRsa([]byte(\"test string\"))\n\n//验签\nerr := c.VerifySignUsingSha256WithRsa([]byte(\"test string\"), sign)\n```\n\n---\n其他\n\n---\n\n* gin跨域设置\n\n```golang\n...\nvar r *gin.Engine\nr.Use(kit.StartCors(\"\", nil))\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeepchen%2Ftoolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeepchen%2Ftoolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeepchen%2Ftoolkit/lists"}