{"id":22281250,"url":"https://github.com/rustcrypto/stream-ciphers","last_synced_at":"2025-04-10T03:42:08.738Z","repository":{"id":17944682,"uuid":"83051505","full_name":"RustCrypto/stream-ciphers","owner":"RustCrypto","description":"Collection of stream cipher algorithms","archived":false,"fork":false,"pushed_at":"2025-03-06T18:13:12.000Z","size":817,"stargazers_count":281,"open_issues_count":8,"forks_count":54,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-03T02:05:06.433Z","etag":null,"topics":["aes-ctr","cfb","cfb8","cryptography","ctr","rust","stream-ciphers"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RustCrypto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-24T14:50:21.000Z","updated_at":"2025-03-28T04:54:05.000Z","dependencies_parsed_at":"2024-01-05T14:29:19.382Z","dependency_job_id":"ae87134e-0877-40c0-95b0-347fed4f30ae","html_url":"https://github.com/RustCrypto/stream-ciphers","commit_stats":{"total_commits":361,"total_committers":27,"mean_commits":13.37037037037037,"dds":0.4404432132963989,"last_synced_commit":"5c7892d0b25a43de9a844e012f11ebaebdd3bc33"},"previous_names":[],"tags_count":111,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2Fstream-ciphers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2Fstream-ciphers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2Fstream-ciphers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2Fstream-ciphers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RustCrypto","download_url":"https://codeload.github.com/RustCrypto/stream-ciphers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154964,"owners_count":21056541,"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-ctr","cfb","cfb8","cryptography","ctr","rust","stream-ciphers"],"created_at":"2024-12-03T16:16:30.530Z","updated_at":"2025-04-10T03:42:08.720Z","avatar_url":"https://github.com/RustCrypto.png","language":"Rust","readme":"# RustCrypto: stream ciphers\n\n[![Project Chat][chat-image]][chat-link]\n[![dependency status][deps-image]][deps-link]\n![Apache2/MIT licensed][license-image]\n[![HAZMAT][hazmat-image]][hazmat-link]\n\nCollection of [stream ciphers] written in pure Rust.\n\n## ⚠️ Security Warning: [Hazmat!][hazmat-link]\n\nCrates in this repository do not ensure ciphertexts are authentic (i.e. by\nusing a MAC to verify ciphertext integrity), which can lead to serious\nvulnerabilities if used incorrectly!\n\nAside from the `chacha20` crate, no crates in this repository have yet\nreceived any formal cryptographic and security reviews/audits.\n\n**USE AT YOUR OWN RISK!**\n\n## Crates\n| Name     | Crate name | Crates.io | Docs | MSRV | Security |\n|----------|------------|-----------|------|------|----------|\n| [ChaCha] | [`chacha20`] | [![crates.io](https://img.shields.io/crates/v/chacha20.svg)](https://crates.io/crates/chacha20) | [![Documentation](https://docs.rs/chacha20/badge.svg)](https://docs.rs/chacha20) | ![MSRV 1.81][msrv-1.81] | 💚 |\n| [HC-256] | [`hc-256`]   | [![crates.io](https://img.shields.io/crates/v/hc-256.svg)](https://crates.io/crates/hc-256) | [![Documentation](https://docs.rs/hc-256/badge.svg)](https://docs.rs/hc-256) | ![MSRV 1.81][msrv-1.81] | [💛](https://link.springer.com/chapter/10.1007/978-3-642-04846-3_4) |\n| [Rabbit] | [`rabbit`]  | [![crates.io](https://img.shields.io/crates/v/rabbit.svg)](https://crates.io/crates/rabbit) | [![Documentation](https://docs.rs/rabbit/badge.svg)](https://docs.rs/rabbit) | ![MSRV 1.81][msrv-1.81] | [💛](https://eprint.iacr.org/2013/780.pdf) |\n| [RC4]    | [`rc4`]  | [![crates.io](https://img.shields.io/crates/v/rc4.svg)](https://crates.io/crates/rc4) | [![Documentation](https://docs.rs/rc4/badge.svg)](https://docs.rs/rc4) | ![MSRV 1.81][msrv-1.81] | [💔](https://www.usenix.org/system/files/conference/usenixsecurity13/sec13-paper_alfardan.pdf) |\n| [Salsa20] | [`salsa20`]  | [![crates.io](https://img.shields.io/crates/v/salsa20.svg)](https://crates.io/crates/salsa20) | [![Documentation](https://docs.rs/salsa20/badge.svg)](https://docs.rs/salsa20) | ![MSRV 1.81][msrv-1.81] | 💚 |\n\n### Security Level Legend\n\nThe following describes the security level ratings associated with each hash function (i.e. algorithms, not the specific implementation):\n\n| Heart          | Description |\n|----------------|-------------|\n| :green_heart:  | No known successful attacks |\n| :yellow_heart: | Theoretical break: security lower than claimed |\n| :broken_heart: | Attack demonstrated in practice: avoid if at all possible |\n\n## Minimum Supported Rust Version (MSRV) Policy\n\nMSRV bump is considered a breaking change and will be performed only with a minor version bump.\n\n## Example\n\nCrates functionality is expressed in terms of traits defined in the [`cipher`] crate.\n\nLet's use ChaCha20 to demonstrate usage of synchronous stream cipher:\n\n```rust\nuse chacha20::ChaCha20;\n// Import relevant traits\nuse chacha20::cipher::{KeyIvInit, StreamCipher, StreamCipherSeek};\nuse hex_literal::hex;\n\nlet key = [0x42; 32];\nlet nonce = [0x24; 12];\nlet plaintext = hex!(\"00010203 04050607 08090a0b 0c0d0e0f\");\nlet ciphertext = hex!(\"e405626e 4f1236b3 670ee428 332ea20e\");\n\n// Key and IV must be references to the `GenericArray` type.\n// Here we use the `Into` trait to convert arrays into it.\nlet mut cipher = ChaCha20::new(\u0026key.into(), \u0026nonce.into());\n\nlet mut buffer = plaintext.clone();\n\n// apply keystream (encrypt)\ncipher.apply_keystream(\u0026mut buffer);\nassert_eq!(buffer, ciphertext);\n\nlet ciphertext = buffer.clone();\n\n// ChaCha ciphers support seeking\ncipher.seek(0u32);\n\n// decrypt ciphertext by applying keystream again\ncipher.apply_keystream(\u0026mut buffer);\nassert_eq!(buffer, plaintext);\n\n// stream ciphers can be used with streaming messages\ncipher.seek(0u32);\nfor chunk in buffer.chunks_mut(3) {\n    cipher.apply_keystream(chunk);\n}\nassert_eq!(buffer, ciphertext);\n```\n\n## License\n\nAll crates licensed under either of\n\n * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n * [MIT license](http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[//]: # (badges)\n\n[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg\n[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260049-stream-ciphers\n[deps-image]: https://deps.rs/repo/github/RustCrypto/stream-ciphers/status.svg\n[deps-link]: https://deps.rs/repo/github/RustCrypto/stream-ciphers\n[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg\n[hazmat-image]: https://img.shields.io/badge/crypto-hazmat%E2%9A%A0-red.svg\n[hazmat-link]: https://github.com/RustCrypto/meta/blob/master/HAZMAT.md\n[msrv-1.81]: https://img.shields.io/badge/rustc-1.81.0+-blue.svg\n\n[//]: # (footnotes)\n\n[stream ciphers]: https://en.wikipedia.org/wiki/Stream_cipher\n[`cipher`]: https://docs.rs/cipher\n\n[//]: # (crates)\n\n[`chacha20`]: ./chacha20\n[`hc-256`]: ./hc-256\n[`rabbit`]: ./rabbit\n[`rc4`]: ./rc4\n[`salsa20`]: ./salsa20\n\n[//]: # (links)\n\n[ChaCha]: https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant\n[HC-256]: https://en.wikipedia.org/wiki/HC-256\n[Rabbit]: https://en.wikipedia.org/wiki/Rabbit_(cipher)\n[RC4]: https://en.wikipedia.org/wiki/RC4\n[Salsa20]: https://en.wikipedia.org/wiki/Salsa20\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustcrypto%2Fstream-ciphers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustcrypto%2Fstream-ciphers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustcrypto%2Fstream-ciphers/lists"}