Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment with using ITaggedData for AES extra data handling #470

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Numpsy
Copy link
Contributor

@Numpsy Numpsy commented May 30, 2020

This is an experiment to use the ITaggedData machinery for handling the AES extra data, too see how it might effect things, and to think if it might be useful for #443 (to have the extra data handling in a central place).

Notes:

  1. It changes the TagID property on ITaggedData from short to ushort to accomodate the 0x9901 value for the AES extra data. Some of the other apis use int rather than short so that might be more consistent, not sure if other places could be changed to keep it working with short though.

  2. Not sure if using ZipHelperStream to unpack the data instead of reading array values is more extra overhead than would be ideal, though i think the read functions in ZipExtraData might already do more size checks than they really need to, so perhaps it could be tuned in general?

  3. Similar on the GetData() side - building the fixed 7 byte array with a temporary stream and 7 calls to write byte is perhaps not the optimal approach there.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@piksel
Copy link
Member

piksel commented Jun 23, 2020

I am currently going through the ExtraFields/ITaggedData for ArchiveDiag and have added some extensions and an Enum with the known IDs. I'm thinking about doing some changes to the API to make it a bit more useful, but that should not affect this too much.

@Numpsy
Copy link
Contributor Author

Numpsy commented Jun 23, 2020

it was initially just to see if it's a reasonable approach to sharing the AES extra data code (rather than just having some other helper functions), rather than a concrete thing, so no problem.

(as far as the shape of the api goes, see my comment about possibly not being terribly efficient, though I don't know what the scope is for changing the interface vs. public API breaks)

@codecov
Copy link

codecov bot commented Oct 4, 2021

Codecov Report

Merging #470 (9bd70bd) into master (b5b1a92) will increase coverage by 0.33%.
The diff coverage is 94.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #470      +/-   ##
==========================================
+ Coverage   73.07%   73.40%   +0.33%     
==========================================
  Files          68       68              
  Lines        8305     8322      +17     
==========================================
+ Hits         6069     6109      +40     
+ Misses       2236     2213      -23     
Impacted Files Coverage Δ
src/ICSharpCode.SharpZipLib/Zip/ZipExtraData.cs 79.23% <92.85%> (+2.90%) ⬆️
src/ICSharpCode.SharpZipLib/Zip/ZipEntry.cs 91.11% <100.00%> (+0.20%) ⬆️
src/ICSharpCode.SharpZipLib/Zip/ZipOutputStream.cs 91.94% <100.00%> (-0.10%) ⬇️
...ode.SharpZipLib/Zip/Compression/DeflaterHuffman.cs 97.87% <0.00%> (+6.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5b1a92...9bd70bd. Read the comment docs.

@Numpsy
Copy link
Contributor Author

Numpsy commented Oct 6, 2021

Just trying to remember what state this was left in...

Any thoughts on the type of TagID, given the comments in the op and in #657 ?

@piksel
Copy link
Member

piksel commented Oct 6, 2021

I think it should definitely be ushort (or even byte[2], but that's a bit less convenient to use).

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.

None yet

2 participants