Giter Club home page Giter Club logo

Comments (4)

stevenroose avatar stevenroose commented on September 13, 2024

If parameters are serializable, please don't forget to implement hashCode
and the == operator.

Btw, glad you're on cipher again :)

On Wed, Oct 15, 2014 at 10:56 PM, Ivan Zaera [email protected]
wrote:

The idea is that a non-randomized algorithm state can be
serialized/recovered with just its CipherParameters. I mean: if two
algorithms with the same name receive the same CipherParameters, they must
result in the same outputs for the same data.

Of course, this cannot be done if some algorithm is randomized, but in
that case, the SecureRandom should be specified in the name so that it is
made explicit. And also, it would still be considered the same algorithm,
it's just that the randomization is different.

This change will allow to merge in pull request #82
#82 that implements hashCode and
equals for all CipherParameters.

If I cannot express SecureRandom as algorithm names and I cannot get rid
of ParametersWithRandom, I won't merge it in because I don't like to have
unstable semantics for these methods.


Reply to this email directly or view it on GitHub
#87.

from cipher.

izaera avatar izaera commented on September 13, 2024

This bug is because of that PR ;-). It made me think about why ParametersWithRandom cannot implement equals and I think it's because there's something wrong with it. It's the only place where we are passing an "executable" object as a parameter. All other parameters are just data.

BTW: I've been always on cipher, it's just that I've been doing the entropy thing and it made me lose a lot of time. I'll upload the new spin off project soon.

from cipher.

izaera avatar izaera commented on September 13, 2024

I'll remove the init() method and the initialization parameters will be provided in the constructor with a simple syntax resembling a DSL.

For example, AES/CBC for encryption will be instantiated like this:

final aescbc = new BlockCipher("AES/CBC", {
  Param.ForEncryption: true,
  Param.Chain: [{
        Param.Key: [0x00,0x11,0x22,...,0xDD,0xEE,0xFF]
    }, {
        Param.IV: [0x00,0x11,0x22,...,0xDD,0xEE,0xFF]
  }]
});

The first param (ForEncryption) is passed to both AES and CBC. The ones inside the Chain are passed as the order in the algorithm name, i.e., the first one (Key) is for AES and the second (IV) for CBC.

Another benefit of this approach is that reset() is now easily implementable and semantically defined because it returns the state to the same point when the algorithm was created. Also, a new getter for the parameters will be provided that can be used in addition to the algorithmName to serialize the full definition of an algorithm.

from cipher.

stevenroose avatar stevenroose commented on September 13, 2024

This issue was moved to PointyCastle/pointycastle#87

from cipher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.