dartist / dart-bignum

Other
14 stars 11 forks source link

Serialization #37

Open frank-rollpin opened 7 years ago

frank-rollpin commented 7 years ago

What would be the proper way to serialize BigInteger to byte array, and back? There is a "toByteArray" method, but the "fromBytes" factory accepts two parameters (int signum, List magnitude) - shouldn't this method be modified to accept just bytes?

On a separate subject (don't want to create two threads), I wonder if this project is still maintained/actively used? Just found another library (https://github.com/a14n/dart-rational), and it does look pretty good...

rinick commented 7 years ago

there is a fromByteArray method in the dartvm implementation. we probably should move that to v8 implementation too and add it to public interface.

this library is more optimized if you want to use the same lib for both js and dartvm, because on dartvm it uses the native big int, so it's much faster than any custom structure for big int.