Skip to content

Conversation

ThomasWaldmann
Copy link
Member

borg 1.x involved the key a bit unusually in the blake2b hash calculation (padding 64B of key material with another 64B of zeros to a total of 128B and then just prepending it to the data).

since a while, we use blake2b from python stdlib and they support passing the key as a separate argument. up to 64B keys are allowed here.

besides the way how the 64B of key material are passed, there are also other differences in how the key gets involved in the digest computation, thus the legacy blake2b hashes from borg 1.x are not compatible with the ones borg 2 will use. The hash is not the same for same key and data values.

Copy link

codecov bot commented May 28, 2025

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.46%. Comparing base (5aa536d) to head (8e85f90).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/borg/archiver/benchmark_cmd.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8887      +/-   ##
==========================================
+ Coverage   81.43%   81.46%   +0.02%     
==========================================
  Files          77       77              
  Lines       13515    13530      +15     
  Branches     2004     2004              
==========================================
+ Hits        11006    11022      +16     
  Misses       1853     1853              
+ Partials      656      655       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann ThomasWaldmann force-pushed the fix-blake2b-key branch 2 times, most recently from ccf8455 to 3ec10c5 Compare May 29, 2025 17:41
borg 1.x involved the key a bit unusually in the blake2b
hash calculation (padding 64B of key material with another
64B of zeros to a total of 128B and then just prepending
it to the data).

since a while, we use blake2b from python stdlib and they
support passing the key as a separate argument. up to 64B
keys are allowed here.

besides the way how the 64B of key material are passed, there
are also other differences in how the key gets involved in
the digest computation, thus the legacy blake2b hashes from
borg 1.x are not compatible with the non-legacy ones - the
hash is not the same for same key and data values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant