Comments (3)
Another real world hazard is that you can't just change the associated data parameters over time. If you want to add a third parameter (let's say the filesystem type), you need to change the context string in step 1. Otherwise the key you were using for [application stuff] before is now an intermediate subkey, which is no bueno.
If we wanted a scheme that was robust to this, we could imagine some sort of "finalization" step, that distinguishes between intermediate subkeys and output subkeys. But is that really necessary? I feel like encouraging people to reuse the same context string would be a bad precedent.
from blake3.
What we don't want to do is skip steps entirely
You could use the rust type system for this, for example
pub struct Stage2 {
}
impl Stage2 {
pub(crate) fn new() -> Self {
Self {}
}
pub fn start_hash(data: &[u8]) {}
}
pub fn init_key(_: &str) -> Stage2 {
// do something necessary
Stage2::new()
}
This would make it impossible to call start_hash
without calling init_key
, so there is no possible way to skip this step.
Alternatively you could also wrap the data in a new type
struct Key(Vec<u8>);
which could then be passed to a function as an argument.
from blake3.
Agreed, providing a secure Rust API for key derivation with associated data wouldn't be too hard. But I'm thinking more about providing advice for protocol designers. Or maybe for coders using some other implementation of BLAKE3, in some other language. (Maybe even folks who aren't using BLAKE3.) I'm hoping to define some sort of Right Way to Do It in the abstract.
from blake3.
Related Issues (20)
- Major version of soname set incorrectly in C library HOT 6
- C function "chunk_state_update" modifies function parameters HOT 1
- Please provide slimmed down version of b3sum HOT 5
- Reference implementation of Blake3 for generic 16/32/64 bit CPUs? HOT 3
- (Feature request) Create hashes for remote files with b3sum HOT 2
- Guard around .note.GNU-stack sections in c/blake3_*_x86-64_unix.S is too restrictive
- blake3.c:354:22: error: logical βandβ of mutually exclusive tests is always false [-Werror=logical-op]
- Compilation failure on Windows when using clang-cl (blake3 1.5.0) HOT 2
- Consider multi-message batching
- Slow HDD read. HOT 8
- AVX512 test failure HOT 2
- How to modify the number of rounds for blake3? HOT 2
- Error while compiling blake3 as dependency
- cross compile for aarch64_unknown_linux_gnu fails with `fatal error: arm_neon.h: No such file or directory`
- Bitsize of the MAC output of blake3
- Failed to build c code with CMake on Windows HOT 5
- NEON version slower on Arm Cortex-A9
- Hackare
- Hash should serialize as byte string HOT 5
- 1.5.2 breaks serialization for formats like "bincode" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blake3.