[CFRG] Re: BLAKE3 I-D
Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com> Wed, 14 August 2024 21:11 UTC
Return-Path: <jeanphilippe.aumasson@gmail.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0D29AC14F736; Wed, 14 Aug 2024 14:11:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.105
X-Spam-Level:
X-Spam-Status: No, score=-7.105 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SXBMqsEnVptw; Wed, 14 Aug 2024 14:11:47 -0700 (PDT)
Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8C914C1840EF; Wed, 14 Aug 2024 14:11:47 -0700 (PDT)
Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2cb53da06a9so206082a91.0; Wed, 14 Aug 2024 14:11:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723669906; x=1724274706; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=j+yJ1cHYlUvFX48GCUpew5c1xsNsaoP3XspYiQ4ZzI4=; b=lQilCQEjf9SpFlUyICp6Uh4UlYAC3xOAukIDdWeteoWJUNCWSoUd3PMNOAhTULdzjH 24FCfKjTaE/4jZnGjGmeT8OhYxih9sRWwUgW17K9P7b0OCKbPKOvndQkTfHBAUSA0uNs ZRyjltXcj0zuDPFVU9qWpj75gQkJItVFf07T5PC86YbrCNZqhyYmjXXbkv4uUy4Pxb9U LoQNmzlrmvqNR17nQnnuA2Jdt6xyRps9ZLQokvpWtBFP0lgQAjaG+rnSi1c2eMUQNh3Q TSAqvJvsl2lIoYrr0I0Yp8YBdQlOtGbBPGHq52x8Y0ymNbqx9nSfA+aXOWQaGzJITd/W hUnQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723669907; x=1724274707; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j+yJ1cHYlUvFX48GCUpew5c1xsNsaoP3XspYiQ4ZzI4=; b=IeHFoFTgt+a5SAJuZzlns2njG+t25KupPSp8yg905d67V1M6M4cnplqm1foRZy83qq cN05KObx28KjkkP2FJO1RigocVoBYYqoSvRBxONeJ9e25EaOZqYUDS8hM/AWOIpsM3gA YcjoO68ltJ4i5rY0ikaQ2mZLOpt0gbnAyh40taoQU1FueeNv1s+l5hoj3uv9AzGqg2Iu 7ftQ8bNBgc5aAc/CKjrSkgcChM/03ttW2VTC0HH2rkSMAZ0/ZXQJpTjpXbxnyRad3H63 qGgdTOxuFYarG19dKkbwgicjGkCR2Ujpx8qOEFj0zNrSMOvV7D1DRCuTqvFyDBwPSFTP Czvw==
X-Forwarded-Encrypted: i=1; AJvYcCV+GVZ3Mn7E4LJ2IQSA+Q9RwgrHnsLDDo+PBcoBCLExhMc3Isq5PfyibDbKmhLo3v6AEoc3NQBSMkuJeRm32zNbwRJ7MrGsVtGLbN2y+ZWiKaTARw==
X-Gm-Message-State: AOJu0YzbiZqTKpo+fUFObIWEaASdSIC5uHFJ28zo8EJJHWU6YjIJx7YL wD6xN/WWoNP9C4TKJ7oSyYaumoBPLrJuLDKUH3wKVMJsGDz9uFrGifi+YGCZxRwBn7XZ/G1lsGn qbGNU1kTFumIPuZpgfbZvPm3Nr1g=
X-Google-Smtp-Source: AGHT+IGuyIZBQDjrjhzeNfQ4fWWL03WXoUzqx/u0VagYWOj/0El8nMsWwChLf5DS8dZux9roGCl/VFfAGqlCFPDwJyY=
X-Received: by 2002:a17:90b:3cb:b0:2d3:c365:53b1 with SMTP id 98e67ed59e1d1-2d3c39574e4mr1311799a91.6.1723669906402; Wed, 14 Aug 2024 14:11:46 -0700 (PDT)
MIME-Version: 1.0
References: <CAGiyFdfKZ1qsPR62kb8M_EqfGOfuU4nkEY4JjLCwBb_JOZdxOA@mail.gmail.com> <CAMr0u6kpcRvsifS3GRX0LNCD1LODo_pePZo51K7okfQtatEgNA@mail.gmail.com> <CAGiyFdfAFT4HzxNLB4QKdGs8F8QD-y5LmMpnH=C+O8+2XF8eBQ@mail.gmail.com> <CAG2Zi20x1WvGH3FdhOW0HjpDfJhgfnSJUvXsoqywgn4vy_1eGA@mail.gmail.com> <CA+6di1kw4rPcseBUfAc=kTLbQSXGyph9wHZV-fn9CEg5KjOkgA@mail.gmail.com>
In-Reply-To: <CA+6di1kw4rPcseBUfAc=kTLbQSXGyph9wHZV-fn9CEg5KjOkgA@mail.gmail.com>
From: Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
Date: Wed, 14 Aug 2024 14:11:30 -0700
Message-ID: <CAGiyFddomJZ2FTT=8humpJ-83XCC72tyvV3AxWpUOj1eGeaWpg@mail.gmail.com>
To: Jack O'Connor <oconnor663@gmail.com>
Content-Type: multipart/alternative; boundary="0000000000007b37f6061fab2c67"
Message-ID-Hash: EOAE64HAVVCVWJMEUTAJ74XY6BQMCQA5
X-Message-ID-Hash: EOAE64HAVVCVWJMEUTAJ74XY6BQMCQA5
X-MailFrom: jeanphilippe.aumasson@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cfrg.irtf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: cfrg@ietf.org, cfrg-chairs@ietf.org, Zooko O'Whielacronx <zookog@gmail.com>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [CFRG] Re: BLAKE3 I-D
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/zmoJ6Z4NO8R4ts9JmkXv_hQWrjY>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Owner: <mailto:cfrg-owner@irtf.org>
List-Post: <mailto:cfrg@irtf.org>
List-Subscribe: <mailto:cfrg-join@irtf.org>
List-Unsubscribe: <mailto:cfrg-leave@irtf.org>
Looks like Jack's email didnt make it through the ietf.org email filters: On Wed, Aug 14, 2024 at 12:56 PM Jack O'Connor <oconnor663@gmail.com> wrote: > Hi Chris, here's my (biased of course) summary of some of the features and > advantages of BLAKE3: > > If you haven't yet compared the performance of B3 and K12, I suggest the > following quick-and-dirty benchmark. Here's a run on my laptop: > > # Install Rust and Cargo, see https://rustup.rs/ > $ cargo install b3sum k12sum hyperfine > ... > $ head -c 1000000000 /dev/random > /tmp/f > $ hyperfine "sha512sum /tmp/f" "k12sum /tmp/f" "b3sum /tmp/f" > ... > Summary > b3sum /tmp/f ran > 3.95 ± 0.10 times faster than k12sum /tmp/f > 23.81 ± 0.57 times faster than sha512sum /tmp/f > > The main difference between B3 and K12 in this case is that, while both > make extensive use of SIMD parallelism, only b3sum is multithreaded. > k12sum could use multithreading in theory, but in practice I'm not aware > of any multithreaded implementations of K12. The difference in tree > structures is important: B3 is a binary tree with the usual recursive > structure, which lets us use "divide-and-conquer" / "fork-join" parallelism > of the sort provided by OpenMP in C/C++ or Rayon in Rust. K12 has a > shallow/one-parent structure, which would need some sort of job queue with > more synchronization and tuning, and the root note itself can be a > bottleneck. (TurboSHAKE has a serial structure and can't take much > advantage of SIMD or threads, which is a major performance disadvantage on > modern machines.) > > B3 also performs better in software on 32-bit embedded systems, because it > uses 32-bit words internally. (K12 and TurboSHAKE use 64-bit words.) This > is important for protocol designs that want to support embedded systems, > don't want to assume hardware acceleration, and don't want to negotiate > algorithms at runtime. In particular, I think this is why WireGuard uses > BLAKE2s instead of BLAKE2b or SHA-2, and BLAKE3 is derived most directly > from BLAKE2s. > > The B3 XOF is counter-based, similar to ChaCha or AES-CTR, which makes it > parallelizable and suitable as a stream cipher or a high-performance > CSPRNG. K12 and TurboSHAKE use a sponge-style XOF that isn't parallelizable. > > B3 supports "streaming verification", where the recipient of a large file > verifies chunks as they arrive instead of buffering the whole file and > verifying everything at the end. See https://github.com/oconnor663/bao > (my work) and https://www.iroh.computer/docs/layers/blobs (others' work). > K12 can't do this efficiently, because of the difference in tree > structures. (TurboSHAKE isn't a tree and can't do this at all.) > > Compared to BLAKE2, which comes in "b", "s", "bp", and "sp" variants (plus > "X"), BLAKE3 is just BLAKE3. There are no variants, no tricky choices for > callers to make. > > The standard BLAKE3 API is three functions: hash > <https://docs.rs/blake3/latest/blake3/fn.hash.html>, keyed_hash > <https://docs.rs/blake3/latest/blake3/fn.keyed_hash.html>, and derive_key > <https://docs.rs/blake3/latest/blake3/fn.derive_key.html>. The keyed_hash > function is similar to HMAC, but it's much faster for short inputs, > requiring only one compression instead of four. The derive_key function > is similar to HKDF, but also much faster for short inputs, less confusing, > and designed to help existing applications introduce key derivation in a > backwards compatible way. (See Section 6.2 of the BLAKE3 spec > <https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf>.) > > Projects currently using BLAKE3 in production include LLVM, Bazel, > OpenZFS, IPFS, and apparently Tekken 8 > <https://twitter.com/rodarmor/status/1751567502050771189>. We keep an > incomplete list on GitHub > <https://github.com/BLAKE3-team/BLAKE3/?tab=readme-ov-file#adoption--deployment> > . > > - Jack > > On Wed, Aug 14, 2024 at 9:56 AM Christopher Patton <cpatton@cloudflare.com> > wrote: > >> Hi JP, it may be reasonable to have an update to the existing BLAKE2 >> RFC. How does BLAKE3 compare to TurboSHAKE/KangarooTwelve? Its RFC is >> nearly finished ( >> https://datatracker.ietf.org/doc/draft-irtf-cfrg-kangarootwelve/) and we >> already have applications for it. Are there use cases for which you think >> BLAKE3 is better suited? >> >> Chris P. >> >> On Fri, Jul 26, 2024 at 6:46 AM Jean-Philippe Aumasson < >> jeanphilippe.aumasson@gmail.com> wrote: >> >>> Dear CFRG members, >>> >>> We created an I-D for BLAKE3, a popular hash function that can be also >>> used as PRF, MAC, KDF, XOF:: >>> >>> https://datatracker.ietf.org/doc/draft-aumasson-blake3/ >>> >>> We would like to eventually turn it into an RFC, to formally standardize >>> BLAKE3 and make it eligible for integration in systems and organizations >>> that require this (like OpenSSL). >>> >>> See also https://github.com/BLAKE3-team/BLAKE3/blob/master/README.md. >>> >>> BLAKE3 is often used via the b3sum utility, for example from >>> https://crates.io/crates/b3sum >>> https://formulae.brew.sh/formula/b3sum >>> >>> In the I-D we tried to describe BLAKE3's tree mode in the simplest way >>> possible, yet in a way sufficient to implement. The I-D does not include >>> source code, however, but instead refers to our C or Rust reference code at >>> https://github.com/BLAKE3-team/BLAKE3. >>> >>> We would appreciate any informal feedback at this stage, and then we >>> would like to proceed with the formal review process as soon as possible. >>> We will follow the recommendations and instructions of the CFRG chairs, as >>> we are not familiar with the process. >>> >>> Thank you for your attention to this new I-D submission. >>> >>> JP, on behalf of the BLAKE3 team (Jack, Samuel, Zooko) >>> >>> >>> _______________________________________________ >>> CFRG mailing list -- cfrg@irtf.org >>> To unsubscribe send an email to cfrg-leave@irtf.org >>> >>
- [CFRG] Re: BLAKE3 I-D Jean-Philippe Aumasson
- [CFRG] Re: BLAKE3 I-D Christopher Patton
- [CFRG] Re: BLAKE3 I-D Christopher Patton
- [CFRG] Re: BLAKE3 I-D Jean-Philippe Aumasson
- [CFRG] Re: BLAKE3 I-D Christopher Patton
- [CFRG] Fwd: Re: BLAKE3 I-D Jack O'Connor
- [CFRG] Re: BLAKE3 I-D Jean-Philippe Aumasson
- [CFRG] Re: BLAKE3 I-D Jean-Philippe Aumasson
- [CFRG] Re: BLAKE3 I-D Jack O'Connor
- [CFRG] Re: BLAKE3 I-D Christopher Patton
- [CFRG] Re: BLAKE3 I-D Chris Barber
- [CFRG] Re: BLAKE3 I-D Jack O'Connor
- [CFRG] Re: BLAKE3 I-D Eric Rescorla
- [CFRG] Re: BLAKE3 I-D Jean-Philippe Aumasson
- [CFRG] Re: BLAKE3 I-D Benson Muite
- [CFRG] Re: BLAKE3 I-D Eric Rescorla
- [CFRG] Re: BLAKE3 I-D Benson Muite
- [CFRG] Re: BLAKE3 I-D Phillip Hallam-Baker
- [CFRG] Re: BLAKE3 I-D Jean-Philippe Aumasson
- [CFRG] Re: BLAKE3 I-D Benson Muite