{"id":27106482,"url":"https://github.com/jcbritobr/libnacl","last_synced_at":"2025-10-14T20:11:13.126Z","repository":{"id":44958161,"uuid":"448392471","full_name":"jcbritobr/libnacl","owner":"jcbritobr","description":"Rust wrapper API for libnacl - https://nacl.cr.yp.to/","archived":false,"fork":false,"pushed_at":"2022-05-19T11:25:58.000Z","size":203,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-14T20:05:47.178Z","etag":null,"topics":["api","cryptography","nacl","wrapper-api"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/jcbritobr.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-01-15T21:14:26.000Z","updated_at":"2023-07-13T21:48:42.000Z","dependencies_parsed_at":"2022-09-03T17:12:13.830Z","dependency_job_id":null,"html_url":"https://github.com/jcbritobr/libnacl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jcbritobr/libnacl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcbritobr%2Flibnacl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcbritobr%2Flibnacl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcbritobr%2Flibnacl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcbritobr%2Flibnacl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcbritobr","download_url":"https://codeload.github.com/jcbritobr/libnacl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcbritobr%2Flibnacl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279021003,"owners_count":26086946,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"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":["api","cryptography","nacl","wrapper-api"],"created_at":"2025-04-06T19:56:04.504Z","updated_at":"2025-10-14T20:11:13.108Z","avatar_url":"https://github.com/jcbritobr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# ![salt](images/salt.png) Rust NACL Wrapper API\nNaCl (pronounced \"salt\") is a new easy-to-use high-speed software library for network communication, encryption, decryption, signatures, etc. NaCl's goal is to provide all of the core operations needed to build higher-level cryptographic tools.\nOf course, other libraries already exist for these core operations. NaCl advances the state of the art by improving security, by improving usability, and by improving speed.\n\nThis library doesn't provides a hexadecimal encoder. Users can encode the hashes and signatures using [Hex](https://github.com/KokaKiwi/rust-hex) crate.\n\n* Migration Status\n\n- [x] Crypto Box \n- [ ] Crypto Secret Box \n- [x] Crypto Hash\n- [x] Crypto Sign\n- [x] Documentation\n- [x] Tests\n\n* **Build**\n```\n$ cargo build --release\n```\n\n* **Test**\n```\n$ cargo test\n```\n\n* **Hashing**\n``` rust\n    let message = \"The quick brown fox jumps over the lazy dog\";\n    let hash_512 = crypto_hash_sha512(message.as_bytes().to_vec()).unwrap();\n    assert_eq!(CRYPTO_HASH_SHA512_BYTES, hash_512.len());\n```\n\n* **Secret Key Encryption**\n\n* **Public Key Encryption**\n```rust\n    // Alice and Bob exchanges their public keys\n    let (alice_pk, alice_sk) = crypto_box_keypair().unwrap();\n    let (bob_pk, bob_sk) = crypto_box_keypair().unwrap();\n\n    let message = \"The quick brown fox jumps over the lazy dog\";\n    let nonce = vec![0u8; CRYPTO_BOX_CURVE_25519XSALSA20POLY1305_NONCEBYTES];\n    let nonce_to_open = nonce.clone();\n    // Alice encrypts and authenticates a message with her secret key and Bobs public key\n    let crypto_text = crypto_box(message.as_bytes().to_vec(), nonce, bob_pk, alice_sk).unwrap();\n\n    // Bob decrypts and validates Alices message with his secret key and Alices public key\n    let decrypted_message =\n        crypto_box_open(crypto_text, nonce_to_open, alice_pk, bob_sk).unwrap();\n    assert_eq!(\n        message,\n        std::str::from_utf8(\n            \u0026decrypted_message[CRYPTO_BOX_CURVE_25519XSALSA20POLY1305_ZEROBYTES..]\n        )\n        .unwrap()\n    );\n```\n\n* **Digital Signatures**\n``` rust\n    let (pk, sk) = crypto_sign_keypair().unwrap();\n    let message = \"The quick brownfox jumps over the lazy dog\";\n    let signed_message = crypto_sign(message.as_bytes().to_vec(), sk).unwrap();\n    let validated_message = crypto_sign_open(signed_message, pk).unwrap();\n    let validated_message = std::str::from_utf8(\u0026validated_message)\n        .unwrap()\n        .trim_matches(char::from(0));\n    assert_eq!(message, validated_message);\n```\n\n# References\n\nhttps://nacl.cr.yp.to/\n\n[PDF](https://cr.yp.to/highspeed/coolnacl-20120725.pdf) - Daniel J. Bernstein, Tanja Lange, Peter Schwabe, \"The security impact of a new cryptographic library\"\n\n[PyNacl](https://pynacl.readthedocs.io/en/latest/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcbritobr%2Flibnacl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcbritobr%2Flibnacl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcbritobr%2Flibnacl/lists"}