Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

add trait for length-preserving encryption

オープン
#1,332 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
rust
領域
cryptography

調査の方向性

まず、リンクされている RustCrypto の traits と block-ciphers の issues を比較し、次に issue にリンクされている HCTR2 論文を読む。提案されている Lpe および LpeMut API、エラーハンドリング、最小長、バッファーのコピー方法がプロジェクトに適合するかを明確にする。完了条件は、trait 設計が承認され、未解決の疑問について合意された解決策があること。

索引モデルが issue の本文から書いたものです。

説明

cipher

Sort of similar to https://github.com/RustCrypto/traits/issues/177 and https://github.com/RustCrypto/block-ciphers/issues/48, but for tweakable SPRPs like HCTR2.

If accepted, I can provide an implementation of HCTR2.

Sample API, trait names are TBD:

pub trait Lpe {
    /// Encrypts `src` into `dst` using `tweak`
    ///
    /// In is an error if `dst` is not at least as long as `src` or if either are less
    /// than [`BLOCK_SIZE`] bytes long.
    fn seal(&self, dst: &mut [u8], src: &[u8], tweak: &[u8]) -> Result<(), Error> {
        if dst.len() < src.len() { ... }
        dst[..src.len()].copy_from_slice(src);
        match self.seal_in_place(dst, tweak) {
            Ok(()) => Ok(()),
            Err(err) => {
                    // This isn't strictly necessary, but there isn't any
                    // harm in doing it.
                    dst[..src.len()].zeroize();
                    Err(err)
            }
        }
    }

    fn open(&self, dst: &mut [u8], src: &[u8], tweak: &[u8]) -> Result<(), Error> {
         // etc
    }

    fn seal_in_place(&self, data: &mut [u8], tweak: &[u8]) -> Result<(), Error>;
    fn open_in_place(&self, data: &mut [u8], tweak: &[u8]) -> Result<(), Error>;
}
pub trait LpeMut { ... }

Some thoughts:

  1. I don't like how the API returns a Result, but I'm not sure how else to express that there must be at least one block of plaintext without requiring Block, panicking, or a lot of typenum gymnastics.
  2. I don't know if all LPE algorithms require the length of the plaintext to be at least one block, but I assume most do.
  3. seal and open aren't strictly necessary, but encrypting from src to dst is very common and it would be a shame if doing that always required copying the entire input.
主要言語
Rust
スター
760
フォーク
258
平均マージ
2時間 53分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RustCrypto/traits のほかの issue

RustCrypto/traits の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。