{"id":15973402,"url":"https://github.com/M3DZIK/rust-crypto-utils","last_synced_at":"2025-05-13T04:33:08.360Z","repository":{"id":37018762,"uuid":"502319855","full_name":"M3DZIK/rust-crypto-utils","owner":"M3DZIK","description":"Cryptography Utils for Rust","archived":false,"fork":false,"pushed_at":"2022-12-26T23:10:40.000Z","size":81,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-09T00:52:51.633Z","etag":null,"topics":["crypto","crypto-library","cryptography","hash","hmac","jsonwebtoken","jwt","rust","rust-crate","rust-lang","rust-language","rustlang"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/crypto-utils","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/M3DZIK.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-06-11T10:41:57.000Z","updated_at":"2023-04-25T04:33:28.000Z","dependencies_parsed_at":"2023-01-17T13:28:40.031Z","dependency_job_id":null,"html_url":"https://github.com/M3DZIK/rust-crypto-utils","commit_stats":null,"previous_names":["medzikuser/rust-crypto-utils"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M3DZIK%2Frust-crypto-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M3DZIK%2Frust-crypto-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M3DZIK%2Frust-crypto-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M3DZIK%2Frust-crypto-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M3DZIK","download_url":"https://codeload.github.com/M3DZIK/rust-crypto-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225182546,"owners_count":17434114,"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":["crypto","crypto-library","cryptography","hash","hmac","jsonwebtoken","jwt","rust","rust-crate","rust-lang","rust-language","rustlang"],"created_at":"2024-10-07T21:04:47.919Z","updated_at":"2024-11-18T13:12:34.958Z","avatar_url":"https://github.com/M3DZIK.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cryptography Utils for Rust\n\n[![github]](https://github.com/MedzikUser/rust-crypto-utils)\n[![crates-io]](https://crates.io/crates/crypto-utils)\n[![docs-rs]](https://docs.rs/crypto-utils)\n[![ci]](https://github.com/MedzikUser/rust-crypto-utils/actions/workflows/rust.yml)\n\n[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\n[crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge\u0026labelColor=555555\u0026logo=rust\n[docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\n[ci]: https://img.shields.io/github/workflow/status/MedzikUser/rust-crypto-utils/Rust/main?style=for-the-badge\u0026logo=github\n\nCryptography Utils for Rust\n\n### Importing\nThe driver is available on [crates.io](https://crates.io/crates/crypto-utils). To use the driver in\nyour application, simply add it to your project's `Cargo.toml`.\n\n```toml\n[dependencies]\ncrypto-utils = \"0.4.1\"\n```\n\n### How to use?\n\n#### Compute a Sha hash\n\nQuick and easy Sha1, Sha256 and Sha512 hash computing.\n\n```rust\nuse crypto_utils::sha::{Algorithm, CryptographicHash};\n\n// input data for a hasher\nlet input = \"P@ssw0rd\"; // \u0026str\n\n// compute hash\nlet hash_bytes = CryptographicHash::hash(Algorithm::SHA1, input.as_bytes()); // Vec\u003cu8\u003e\n\n// decode hash to a String\nlet hash = hex::encode(hash_bytes); // String\n\nassert_eq!(hash, \"21bd12dc183f740ee76f27b78eb39c8ad972a757\".to_string())\n```\n\n#### Json Web Token\n\nCreate and decode a token\n\n```rust\nuse crypto_utils::jsonwebtoken::{Claims, Token};\n\nlet secret = b\"secret\";\nlet user_id = \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\";\n\nlet claims = Claims::new(user_id, 24);\nlet token = Token::new(secret, claims).unwrap();\n\nlet decoded = Token::decode(secret, token.encoded).unwrap();\n```\n\n### All Feature flags\n\n| Feature    | Description                                                   | Dependencies                              | Default |\n|:-----------|:-------------------------------------------------------------|:-------------------------------------------|:--------|\n| `sha`      | Enable support for the Sha1, Sha256 and Sha512 hasher         | `sha` and `sha2`                          | yes     |\n| `jwt`      | Enable support for the Json Web Token utils                   | `chrono`, `serde` and `jsonwebtoken`      | yes     |\n\nLicense: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FM3DZIK%2Frust-crypto-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FM3DZIK%2Frust-crypto-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FM3DZIK%2Frust-crypto-utils/lists"}