{"id":37102143,"url":"https://github.com/jathon-yang/go-wxsqlite3","last_synced_at":"2026-01-14T12:22:58.818Z","repository":{"id":42977962,"uuid":"466468444","full_name":"Jathon-yang/go-wxsqlite3","owner":"Jathon-yang","description":"Based on Go SQLite3 driver, wxSQLite3 encrypted database is realized.","archived":false,"fork":false,"pushed_at":"2022-03-25T06:54:09.000Z","size":2741,"stargazers_count":12,"open_issues_count":3,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T14:45:11.210Z","etag":null,"topics":["encryption","go","sqlite3","wxsqlite3"],"latest_commit_sha":null,"homepage":"","language":"C","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/Jathon-yang.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":"2022-03-05T13:57:39.000Z","updated_at":"2024-03-18T15:55:00.000Z","dependencies_parsed_at":"2022-09-22T05:12:52.403Z","dependency_job_id":null,"html_url":"https://github.com/Jathon-yang/go-wxsqlite3","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Jathon-yang/go-wxsqlite3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jathon-yang%2Fgo-wxsqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jathon-yang%2Fgo-wxsqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jathon-yang%2Fgo-wxsqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jathon-yang%2Fgo-wxsqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jathon-yang","download_url":"https://codeload.github.com/Jathon-yang/go-wxsqlite3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jathon-yang%2Fgo-wxsqlite3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420729,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["encryption","go","sqlite3","wxsqlite3"],"created_at":"2026-01-14T12:22:57.978Z","updated_at":"2026-01-14T12:22:58.801Z","avatar_url":"https://github.com/Jathon-yang.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 背景\n\n最近有个小项目需要用到SQLite数据库，go已经有现成的开源库可以实现，但是美中不足的是，开源版本并不支持数据库加密，这个直接在项目中使用，很明显是不行的。\n\n秉承着能不造轮子就不造轮子的原则，在网上搜寻了一下，目前比较有知名度的加密开源实现分别是：wxSQLite3和sqlcipher。其中发现sqlcipher已经有go版本的轮子可以使用了，但是集成后，生成的数据库文件并不能用Navicat打开，到Navicat官网查询后，发现Navicat默认是使用*wxSQLite3* (128-bit AES) 进行加密实现的。为了后续数据查询方便，所以决定用wxSQLite3来实现加密，然而在网上找了许久，都没发现有go版本的wxSQLite3。\n\n最后研究了一下go-sqlite3的实现方式，发现他其实是直接调用C版本的sqlite，那这时候事情就简单，我直接移花接木一下，把里面的C代码替换成wxSQLite3即可，所以就有了现在这个项目。\n\n本项目代码主要是来自以下两个项目：\n\n- [https://github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)\n- https://github.com/utelle/SQLite3MultipleCiphers\n\n# 安装\n\n```go\nimport \"github.com/Jathon-yang/go-wxsqlite3\"\n```\n\n# 使用\n\n```go\nkey := url.QueryEscape(\"123456\")\ndbname := fmt.Sprintf(\"./foo.db?_db_key=%s\", key)\ndb, err := sql.Open(\"sqlite3\", dbname)\n```\n目前项目默认使用的加密算法是128-bit AES，如果想切换加密算法，可以修改 wxsqlite3_cgo.go 中 CODEC_TYPE 的值，目前支持以下几种加密算法：\n\n- CODEC_TYPE_AES128\n- CODEC_TYPE_AES256\n- CODEC_TYPE_CHACHA20\n- CODEC_TYPE_SQLCIPHER\n- CODEC_TYPE_RC4","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjathon-yang%2Fgo-wxsqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjathon-yang%2Fgo-wxsqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjathon-yang%2Fgo-wxsqlite3/lists"}