Giter VIP home page Giter VIP logo

perl6-tweetnacl's People

Contributors

avuserow avatar bduggan avatar niner avatar soundart avatar

Stargazers

 avatar

Watchers

 avatar  avatar

perl6-tweetnacl's Issues

Some Feedback

Hi, I saw the note in the README requesting some feedback. I had some golang code that used these primitives to do SecretBox encryption/decryption so I wrote a bit of P6 code to see how it compared.

I was able to interoperate with the golang code fairly easily so it is great to know that it is compatible with other implementations.

Having written some P6 nativecall-based code in the past, here's some design suggestions based on that. My general philosophy is that I want to use nativecall-based modules to hide the details of C behind things that make more sense from P6. The same thought applies to ctypes in Python or XS in Perl 5 or any other bindings around C language libraries.

To this point, modules should avoid exporting the C functions. So in SecretKey.pm6, you would avoid marking crypto_secretbox_open_int as is export. If you do think that consumers of your modules may want to import and use these directly, consider putting them all in a Raw.pm file, similar to how GTK::Simple does it.

Along these lines, avoid requiring CArray and other NativeCall types as input parameters. I've found that functions taking CArray can be represented by the Blob type, since Blob also permits Buf and utf8, both are fairly common. You can take advantage of some other modules to help here, see the modules in the NativeHelpers:: namespace: http://modules.perl6.org/search/?q=nativehelpers

You may also consider using subtypes of Blob: subset KeyData of Blob where *.elems == 32. Then you can use this as a type parameter.

I would also suggest unifiying the return types of the two encrypt multi methods, since it seems weird to have them return different types depending on if you provide a nonce or not. If you do want different return types, I suggest document this.

Aside from this, I found the code reliable so far, so that's excellent. Thanks for putting this out here so other people can use it, I really appreciate it.

Not sure if you are still actively interested in Perl 6 and/or this code, but thought I would pass along the feedback in hopes that it helps. Let me know if you want any more information or examples and I'll see what I can do.

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.