{"id":21586110,"url":"https://github.com/magiclen/rust-magiccrypt","last_synced_at":"2025-07-06T22:08:09.739Z","repository":{"id":37394579,"uuid":"145989442","full_name":"magiclen/rust-magiccrypt","owner":"magiclen","description":"MagicCrypt is a Java/PHP/NodeJS/Rust library to encrypt/decrypt strings, files, or data, using Data Encryption Standard(DES) or Advanced Encryption Standard(AES) algorithms. It supports CBC block cipher mode, PKCS7 padding and 64, 128, 192 or 256-bits key length.","archived":false,"fork":false,"pushed_at":"2024-11-02T08:50:57.000Z","size":80,"stargazers_count":36,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T03:04:30.848Z","etag":null,"topics":["aes","des","magic-crypt","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magiclen.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,"zenodo":null}},"created_at":"2018-08-24T12:35:14.000Z","updated_at":"2025-02-21T14:53:15.000Z","dependencies_parsed_at":"2025-05-07T17:58:41.904Z","dependency_job_id":null,"html_url":"https://github.com/magiclen/rust-magiccrypt","commit_stats":{"total_commits":54,"total_committers":5,"mean_commits":10.8,"dds":"0.11111111111111116","last_synced_commit":"355a5cd1b56497c3bc71968185be48405aa52c04"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/magiclen/rust-magiccrypt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Frust-magiccrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Frust-magiccrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Frust-magiccrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Frust-magiccrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclen","download_url":"https://codeload.github.com/magiclen/rust-magiccrypt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Frust-magiccrypt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263980181,"owners_count":23538922,"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":["aes","des","magic-crypt","rust"],"created_at":"2024-11-24T15:12:42.683Z","updated_at":"2025-07-06T22:08:09.720Z","avatar_url":"https://github.com/magiclen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"MagicCrypt\n====================\n\n[![CI](https://github.com/magiclen/rust-magiccrypt/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/rust-magiccrypt/actions/workflows/ci.yml)\n\nMagicCrypt is a Java/PHP/NodeJS/Rust library to encrypt/decrypt strings, files, or data, using Data Encryption Standard(DES) or Advanced Encryption Standard(AES) algorithms. It supports CBC block cipher mode, PKCS7 padding and 64, 128, 192 or 256-bits key length.\n\n## For Rust\n\n### Example\n\n```rust\nuse magic_crypt::{new_magic_crypt, MagicCryptTrait};\n\nlet mc = new_magic_crypt!(\"magickey\", 256);\n\nlet base64 = mc.encrypt_str_to_base64(\"http://magiclen.org\");\n\nassert_eq!(\"DS/2U8royDnJDiNY2ps3f6ZoTbpZo8ZtUGYLGEjwLDQ=\", base64);\n\nassert_eq!(\"http://magiclen.org\", mc.decrypt_base64_to_string(\u0026base64).unwrap());\n```\n\n## Change the Buffer Size\n\nThe default buffer size for the `encrypt_reader_to_writer` method and the `decrypt_reader_to_writer` method is 4096 bytes. If you want to change that, you can use the `encrypt_reader_to_writer2` method or the `decrypt_reader_to_writer2` method, and define a length explicitly.\n\nFor example, to change the buffer size to 256 bytes,\n\n```rust\nuse std::io::Cursor;\n\nuse base64::Engine;\nuse magic_crypt::{new_magic_crypt, MagicCryptTrait};\nuse magic_crypt::generic_array::typenum::U256;\n\nlet mc = new_magic_crypt!(\"magickey\", 256);\n\nlet mut reader = Cursor::new(\"http://magiclen.org\");\nlet mut writer = Vec::new();\n\nmc.encrypt_reader_to_writer2::\u003cU256\u003e(\u0026mut reader, \u0026mut writer).unwrap();\n\nlet base64 = base64::engine::general_purpose::STANDARD.encode(\u0026writer);\n\nassert_eq!(\"DS/2U8royDnJDiNY2ps3f6ZoTbpZo8ZtUGYLGEjwLDQ=\", base64);\n\nassert_eq!(\"http://magiclen.org\", mc.decrypt_base64_to_string(\u0026base64).unwrap());\n```\n\n## No Std\n\nDisable the default features to compile this crate without std.\n\n```toml\n[dependencies.magic-crypt]\nversion = \"*\"\ndefault-features = false\n```\n\n### Crates.io\n\nhttps://crates.io/crates/magic-crypt\n\n### Documentation\n\nhttps://docs.rs/magic-crypt\n\n## For Java\n\nRefer to [https://github.com/magiclen/MagicCrypt](https://github.com/magiclen/MagicCrypt).\n\n## For PHP\n\nRefer to [https://github.com/magiclen/MagicCrypt](https://github.com/magiclen/MagicCrypt).\n\n## For NodeJS\n\nRefer to [https://github.com/magiclen/node-magiccrypt](https://github.com/magiclen/node-magiccrypt).\n\n## License\n\n[Apache-2.0](LICENSE)\n\n## What's More?\n\nPlease check out our web page at\n\nhttps://magiclen.org/aes/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Frust-magiccrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclen%2Frust-magiccrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Frust-magiccrypt/lists"}