Giter Club home page Giter Club logo

Comments (4)

gnawf avatar gnawf commented on July 30, 2024

I found it very odd how encodedBytes is exposed. From what I can see it's the memoized result from encode(). It seems like it should be a private implementation detail?

Also throws off people switching from the ASN1Lib package, since their encodedBytes should be changed to encode().

Edit:

The encoding from ASN1Integer(BigInt.from(0)) differs from the current ASN1Lib package and is maybe buggy

Yes I have found the same problem.

Also, seems like the implementation mentions:

Uint8List encodeBigInt(BigInt number) {
  // Not handling negative numbers. Decide how you want to do that.

Not too sure how important that is, but I suppose it should be decided before 2.0.0 stable?

from pc-dart.

Ephenodrom avatar Ephenodrom commented on July 30, 2024

@mwcw @gnawf
I created a PR to fix the above mentioned things.

from pc-dart.

awhitford avatar awhitford commented on July 30, 2024

Related to Ephenodrom/Dart-Basic-Utils#31...

⚠️ I will admit that I am not very familiar with ASN1. The following comments are based on feedback from an exercise I went through in attempting to migrate asn1lib code to pointycastle.

Consider the following:

///
/// Create an [ASN1BitString] entity with the given [stringValues].
///
ASN1BitString(
{this.stringValues, this.elements, int tag = ASN1Tags.BIT_STRING})
: super(tag: tag);

Is tag really something that would/could/should be changed? Why not hard-code it like:

   ASN1BitString( 
       {this.stringValues, this.elements}) 
       : super(tag: ASN1Tags.BIT_STRING); 

?

Migrating from asn1lib1 requires specifying the named parameter, which seems excessive for most use-cases. And does it really make sense to potentially have stringValues and elements? Maybe multiple constructors or factory methods to handle different use-cases makes more sense? Like:

    ASN1BitString(this.stringValues) : super(tag: ASN1Tags.BIT_STRING);
  
    ASN1BitString.fromElements(this.elements) : super(tag: ASN1Tags.BIT_STRING); 

?

from pc-dart.

Ephenodrom avatar Ephenodrom commented on July 30, 2024

Improvements are already merged. Complaints cannot be traced, because the effort for a change is limited.

from pc-dart.

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.