jcryptool / core

JCrypTool Core Plug-ins
https://www.cryptool.org
Eclipse Public License 1.0
161 stars 43 forks source link

Add Byteformatting provider #235

Closed tassadarius closed 3 years ago

tassadarius commented 3 years ago

Issue: https://github.com/jcryptool/crypto/issues/350

Add Byteformatting provider

This PR adds byte functionality to the UnitsService class in org.jcryptool.core.util.units.UnitsService.java, which will replace the old humanReadableByteCount() which is marked as deprecated.

Why?

This feature is required quite often in JCrypTool, so I wanted to provide a proper one which can be adjusted to plug-in needs.

Features

A feature overview can be found in this PDF I created from a Jupyter showcase.

jct_byteformat_jpype_showcase.pdf

grthor commented 3 years ago

Hi, there are some merge conflicts caused by the update of babel, see https://github.com/jcryptool/core/commit/be496e726e85c9e608043d5f4aba0c2549957c0a.

Is the byte formatter ready? If yes, I would solve the merge conflicts and merge the PR. If you still want to make changes to it, then it would be easier if you resolve the conflicts and then make your changes.

By the way, the Jupyter notebook is very cool.

tassadarius commented 3 years ago

Hi, there are some merge conflicts caused by the update of babel, see be496e7.

Is the byte formatter ready? If yes, I would solve the merge conflicts and merge the PR. If you still want to make changes to it, then it would be easier if you resolve the conflicts and then make your changes.

By the way, the Jupyter notebook is very cool.

Thanks, the merge conflict should be resolved now

grthor commented 3 years ago

Can I merge the PR?

tassadarius commented 3 years ago

Can I merge the PR?

yes

Thrameos commented 3 years ago

BTW on the notebook you should be able to write this section

UnitsService = JClass('ByteFormatterPlayground.de.UnitsService')
UnitsServiceEN = JClass('ByteFormatterPlayground.en.UnitsService')
DefaultByteFormatter = JClass('ByteFormatterPlayground.de.DefaultByteFormatter')
DefaultByteFormatterEN = JClass('ByteFormatterPlayground.en.DefaultByteFormatter')
BigInteger = JClass('java.math.BigDecimal')
ActualBigInteger = JClass('java.math.BigInteger')

as

from ByteFormatterPlayground.de import UnitsService ,DefaultByteFormatter
from ByteFormatterPlayground.en import UnitsService as UnitsServiceEN
from ByteFormatterPlayground.en import DefaultByteFormatter as DefaultByteFormatterEN
from java.math import BigDecimal as BigInteger
from java.math import BigInteger as ActualBigInteger

Not sure if it helps clarity in this case.

tassadarius commented 3 years ago

BTW on the notebook you should be able to write this section

UnitsService = JClass('ByteFormatterPlayground.de.UnitsService')
UnitsServiceEN = JClass('ByteFormatterPlayground.en.UnitsService')
DefaultByteFormatter = JClass('ByteFormatterPlayground.de.DefaultByteFormatter')
DefaultByteFormatterEN = JClass('ByteFormatterPlayground.en.DefaultByteFormatter')
BigInteger = JClass('java.math.BigDecimal')
ActualBigInteger = JClass('java.math.BigInteger')

as

from ByteFormatterPlayground.de import UnitsService ,DefaultByteFormatter
from ByteFormatterPlayground.en import UnitsService as UnitsServiceEN
from ByteFormatterPlayground.en import DefaultByteFormatter as DefaultByteFormatterEN
from java.math import BigDecimal as BigInteger
from java.math import BigInteger as ActualBigInteger

Not sure if it helps clarity in this case.

Now that's really cool, thanks for pointing that out!