{"id":13413786,"url":"https://github.com/kevinburke/nacl","last_synced_at":"2025-05-16T03:03:46.460Z","repository":{"id":40275319,"uuid":"97869656","full_name":"kevinburke/nacl","owner":"kevinburke","description":"Pure Go implementation of the NaCL set of API's","archived":false,"fork":false,"pushed_at":"2024-07-08T21:57:07.000Z","size":211,"stargazers_count":547,"open_issues_count":4,"forks_count":31,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-08T13:08:25.189Z","etag":null,"topics":["curve25519","golang","nacl","secretbox","security"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/kevinburke/nacl","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevinburke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-07-20T19:07:19.000Z","updated_at":"2025-04-06T19:01:50.000Z","dependencies_parsed_at":"2024-12-26T20:11:33.317Z","dependency_job_id":null,"html_url":"https://github.com/kevinburke/nacl","commit_stats":{"total_commits":55,"total_committers":3,"mean_commits":"18.333333333333332","dds":"0.036363636363636376","last_synced_commit":"cd9060f5f776bb5d072743c3716d3f30dafc3ba6"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinburke%2Fnacl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinburke%2Fnacl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinburke%2Fnacl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinburke%2Fnacl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinburke","download_url":"https://codeload.github.com/kevinburke/nacl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459084,"owners_count":22074604,"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":["curve25519","golang","nacl","secretbox","security"],"created_at":"2024-07-30T20:01:49.302Z","updated_at":"2025-05-16T03:03:41.450Z","avatar_url":"https://github.com/kevinburke.png","language":"Go","funding_links":[],"categories":["Encryption","Go","Security","安全性","安全","Relational Databases","安全领域相关库"],"sub_categories":["HTTP Clients","交流","Advanced Console UIs","HTTP客户端","查询语"],"readme":"# go-nacl\n\n[![GoDoc](https://godoc.org/github.com/kevinburke/nacl?status.svg)](https://godoc.org/github.com/kevinburke/nacl)\n\nThis is a pure Go implementation of the API's available in NaCL:\nhttps://nacl.cr.yp.to. Compared with the implementation in\ngolang.org/x/crypto/nacl, this library offers *all* of the API's present in\nNaCL, better compatibility with NaCL implementations written in other languages,\nas well as some utilities for generating and loading keys and nonces, and\nencrypting messages.\n\nMany of them are simple wrappers around functions or libraries available in the\nGo standard library, or in the golang.org/x/crypto package. Other code I copied\ndirectly into this library with the appropriate LICENSE; if a function is longer\nthan, say, 5 lines, I didn't write it myself. There are no dependencies outside\nof the standard library or golang.org/x/crypto.\n\nThe goal is to both show how to implement the NaCL functions in pure Go, and\nto provide interoperability between messages encrypted/hashed/authenticated in\nother languages, and available in Go.\n\nAmong other benefits, NaCL is designed to be misuse resistant and standardizes\non the use of 32 byte keys and 24 byte nonces everywhere. Several helpers are\npresent for generating keys/nonces and loading them from configuration, as well\nas for encrypting messages. You can generate a key by running `openssl rand -hex\n32` and use the helpers in your program like so:\n\n```go\nimport \"github.com/kevinburke/nacl\"\nimport \"github.com/kevinburke/nacl/secretbox\"\n\nfunc main() {\n    key, err := nacl.Load(\"6368616e676520746869732070617373776f726420746f206120736563726574\")\n    if err != nil {\n        panic(err)\n    }\n    encrypted := secretbox.EasySeal([]byte(\"hello world\"), key)\n    fmt.Println(base64.StdEncoding.EncodeToString(encrypted))\n}\n```\n\nThe package names match the primitives available in NaCL, with the `crypto_`\nprefix removed. Some function names have been changed to match the Go\nconventions.\n\n### Installation\n\n```\ngo get github.com/kevinburke/nacl\n```\n\nOr you can Git clone the code directly to $GOPATH/src/github.com/kevinburke/nacl.\n\n### Who am I?\n\nWhile you probably shouldn't trust random security code from the Internet,\nI'm reasonably confident that this code is secure. I did not implement any\nof the hard math (poly1305, XSalsa20, curve25519) myself - I call into\ngolang.org/x/crypto for all of those functions. I also ported over every test\nI could find from the C/C++ code, and associated RFC's, and ensured that these\nlibraries passed those tests.\n\nI'm [a contributor to the Go Standard Library and associated\ntools][contributor], and I've also been paid to do [security\nconsulting][services] for startups, and [found security problems in consumer\nsites][capital-one].\n\n[contributor]: https://go-review.googlesource.com/q/owner:kev%2540inburke.com\n[capital-one]: https://burke.services/capital-one-open-redirect.html\n[services]: https://burke.services\n\n### Errata\n\n- The implementation of `crypto_sign` uses the `ref10` implementation of ed25519\nfrom SUPERCOP, *not* the current implementation in NaCL. The difference is that\nthe entire 64-byte signature is prepended to the message; in the current version\nof NaCL, separate bits are prepended and appended to the message.\n\n- Compared with `crypto/ed25519`, this library's Sign\nimplementation returns the message along with the signature, and Verify\nexpects the first 64 bytes of the message to be the signature. This simplifies\nthe API and matches the behavior of the ref10 implementation and other NaCL\nimplementations. Sign also flips the order of the message and the private key:\n`Sign(message, privatekey)`, to match the NaCL implementation.\n\n- Compared with `golang.org/x/crypto/nacl/box`, `Precompute` returns the shared\nkey instead of modifying the input. In several places the code was modified to\ncall functions that now exist in `nacl`.\n\n- Compared with `golang.org/x/crypto/nacl/secretbox`, `Seal` and `Open`\ncall the `onetimeauth` package in this library, instead of calling\n`golang.org/x/crypto/poly1305` directly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinburke%2Fnacl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinburke%2Fnacl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinburke%2Fnacl/lists"}